BDC Program for table control
Hi Friends,
I have an issue i am stuck here,
i have to create BDC Program for XK01 tcode,
and my requirement is that,
i have three users first user want only three colum and second user want four column
and third user want five column in table control,
so how could i achieve it,
please hekp me out.
Thanks
Vikash
Hi Vikash,
FORM bdc_dynpro USING p_program p_dynpro.
IF user-one.
FORM bdc_field USING fnam1 fval.
FORM bdc_field USING fnam2 fval.
FORM bdc_field USING fnam3 fval.
ELSEIF user-two.
FORM bdc_field USING fnam1 fval.
FORM bdc_field USING fnam2 fval.
FORM bdc_field USING fnam3 fval.
FORM bdc_field USING fnam4 fval.
ELSEIF user-three.
FORM bdc_field USING fnam1 fval.
FORM bdc_field USING fnam2 fval.
FORM bdc_field USING fnam3 fval.
FORM bdc_field USING fnam4 fval.
FORM bdc_field USING fnam5 fval.
ENDIF.
Does this make sense?
regards,
Archer.
Similar Messages
-
Program for table control in bdc
Hi All,
Can Anybody provide me program on table control that used in BDC.
Please provide me program also.
thanks
rahul.Hi,
Check this sample code:
report zcustomer_change_bict
no standard page heading line-size 255.
include bdcrecx1.
data: begin of it_record occurs 0,
kunnr like rf02d-kunnr,
d0360 like rf02d-d0360,
anred(30) type c,
name1(35) type c,
namev(35) type c,
telf1(35) type c,
abtnr(10) type c,
end of it_record.
data: begin of it_knvk1 occurs 0,
anred like knvk-anred,
end of it_knvk1.
data: begin of it_knvk2 occurs 0,
name1 like knvk-name1,
end of it_knvk2.
data: begin of it_knvk3 occurs 0,
namev like knvk-namev,
end of it_knvk3.
data: begin of it_knvk4 occurs 0,
telf1 like knvk-telf1,
end of it_knvk4.
data: begin of it_knvk5 occurs 0,
abtnr like knvk-abtnr,
end of it_knvk5.
data : fld(20) type c,
cnt(2) type n.
start-of-selection.
call function 'GUI_UPLOAD'
exporting
filename = 'C:\CUSTCH.TXT'
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE = VIRUS_SCAN_PROFILE
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH = FILELENGTH
HEADER = HEADER
tables
data_tab = it_record
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
perform open_group.
loop at it_record.
refresh bdcdata.
refresh: it_knvk1,it_knvk2,it_knvk3,it_knvk4,it_knvk5.
split it_record-anred at ',' into table it_knvk1.
split it_record-name1 at ',' into table it_knvk2.
split it_record-namev at ',' into table it_knvk3.
split it_record-telf1 at ',' into table it_knvk4.
split it_record-abtnr at ',' into table it_knvk5.
screen 101
perform bdc_dynpro using 'SAPMF02D' '0101'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-D0360'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
it_record-kunnr.
perform bdc_field using 'RF02D-D0360'
it_record-d0360.
screen 360
perform bdc_dynpro using 'SAPMF02D' '0360'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-ABTNR(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'KNVK-ANRED(01)'
record-ANRED_01_003.
*perform bdc_field using 'KNVK-NAMEV(01)'
record-NAMEV_01_004.
*perform bdc_field using 'KNVK-NAME1(01)'
record-NAME1_01_005.
*perform bdc_field using 'KNVK-TELF1(01)'
record-TELF1_01_006.
*perform bdc_field using 'KNVK-ABTNR(01)'
record-ABTNR_01_007.
move 1 to cnt.
loop at it_knvk1 .
concatenate 'knvk-anred( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk1-anred.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk2 .
concatenate 'knvk-name1( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk2-name1.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk3 .
concatenate 'knvk-namev( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk3-namev.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk4 .
concatenate 'knvk-telf1( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk4-telf1.
cnt = cnt + 1.
endloop.
move 1 to cnt.
loop at it_knvk5 .
concatenate 'knvk-abtnr( ' cnt ' ) ' into fld.
perform bdc_field using fld it_knvk5-abtnr.
cnt = cnt + 1.
endloop.
screen 360
perform bdc_dynpro using 'SAPMF02D' '0360'.
perform bdc_field using 'BDC_CURSOR'
'KNVK-NAMEV(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_transaction using 'XD02'.
endloop.
perform close_group. -
how to write BDC coding based on Table Controls...
http://www.sap-basis-abap.com/abap/handling-table-control-in-bdc.htm
How to deal with table control / step loop in BDC
Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')
Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.
Demo ABAP code has two purposes:
1. how to determine number of visible lines and how to calculte page number;
(the 'calpage' routine has been modify to meet general purpose usage)
2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.
Now I begin to describe the step to implement my method:
(I use transaction 'ME21', screen 121 for sample,
the method using is Call Transation Using..)
Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.
(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)
Now we have : FixedLine = 9
LoopLine = 2(for table control, LoopLine is always equal to 1)
Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.
Now we have: FirstLine = 0
or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)
Step3: write a subroutine calcalculating number of pages
(here, the name of actual parameter is the same as formal parameter)
global data: FixedLine type i, " number of fixed line on a certain screen
LoopLine type i, " the number of lines occupied by one steploop item
FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1
Dataline type i, " number of items you will use in BDC, using DESCRIBE to get
pageno type i, " you need to scroll screen how many times.
line type i, " number of lines appears on the screen.
index(2) type N, " the screen index for certain item
begin type i, " from parameter of loop
end type i. " to parameter of loop
*in code sample, the DataTable-linindex stands for the table index number of this line
form calpage using FixedLine type i (see step 1)
LoopLine type i (see step 1)
FirstLine type i (see step 2)
DataLine type i ( this is the item number you will enter in transaction)
changing pageno type i (return the number of page, depends on run-time visible line in table control/ Step Loop)
changing line type i.(visible lines one the screen)
data: midd type i,
vline type i, "visible lines
if DataLine eq 0.
Message eXXX.
endif.
vline = ( sy-srows - FixedLine ) div LoopLine.
*for table control, you should compare vline with maximum line of
*table control, then take the small one that is min(vline, maximum)
*here only illustrate step loop
if FirstLine eq 0.
pageno = DataLine div vline.
if pageno eq 0.
pageno = pageno + 1.
endif.
elseif FirstLine eq 1.
pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
midd = ( DataLine - 1 ) mod ( vline - 1).
if midd = 0 and DataLine gt 1.
pageno = pageno - 1.
endif.
endif.
line = vline.
endform.
Step4 write a subroutine to calculate the line index for each item.
form calindex using Line type i (visible lines on the screen)
FirstLine type i(see step 2)
LineIndex type i(item index)
changing Index type n. (index on the screen)
if FirstLine = 0.
index = LineIndex mod Line.
if index = '00'.
index = Line.
endif.
elseif FirstLine = 1.
index = LineIndex mod ( Line - 1 ).
if ( index between 1 and 0 ) and LineIndex gt 1.
index = index + Line - 1.
endif.
if Line = 2.
index = index + Line - 1.
endif.
endif.
endform.
Step5 write a subroutine to calculate the loop range.
form calrange using Line type i ( visible lines on the screen)
DataLine type i
FirstLine type i
loopindex like sy-index
changing begin type i
end type i.
If FirstLine = 0.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loopindex gt 1.
begin = Line * ( loopindex - 1 ) + 1.
end = Line * loopindex.
if end gt DataLine.
end = DataLine.
endif.
endif.
elseif FirstLine = 1.
if loopindex = 1.
begin = 1.
if DataLine <= Line.
end = DataLine.
else.
end = Line.
endif.
elseif loop index gt 1.
begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
end = ( Line - 1 ) * ( loopindex - 1 ) + Line.
if end gt DataLine.
end = DataLine.
endif.
endif.
endif.
endform.
Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control
form creat_bdc.
field-symbols: <material>, <quan>, <indicator>.
data: name1(14) value 'EKPO-EMATN(XX)',
name2(14) value 'EKPO-MENGE(XX)',
name3(15) value 'RM06E-SELKZ(XX)'.
assign: name1 to <material>,
name2 to <quan>,
name3 to <indicator>.
do pageno times.
if sy-index gt 1
*insert scroll page ok_code"
endif.
perform calrange using Line DataLine FirstLine sy-index
changing begin end.
loop at DataTable from begin to end.
perform calindex using Line FirstLine DataTable-LineIndex changing Index.
name1+11(2) = Index.
name2+11(2) = Index.
name3+12(2) = Index.
perform bdcfield using <material> DataTable-matnr.
perform bdcfield using <quan> DataTable-menge.
perform bdcfield using <indicator> DataTable-indicator.
endloop.
enddo.
Cheers
VJ -
BDC Recording for Table Control
dears,
I am using BDC for posting payments by TCode FP05.
after processing two payment items i am getting the following error.
"Runtime error SAPSQL_ARRAY_INSERT_DUPREC has occurred"
but when i repeat the same recording in foreground it processes the payment sucessfully.
wht could be wrong with the recording?
how to record for table control?
ByeHi Syed,
I could find few notes for the array insert duplicate runtime error.
136433
191544
You can find may in OSS.
Cheers
Vinod -
BDC programming and table controls selColumns
Hello,
I have a small question regarding BDC programming. I am already quite familiar with the process in creating one but I have one question regarding table control and its selColumns.
Transactions like pa40 would require its users to select one of the rows in the table controls via SelColumns. My questions is how would you simulate this using BDC.
Thanks people and take care.Hai Chad Cheng
report Z_TAB_CONTRL_01
no standard page heading line-size 255.
data : begin of it_kna1 occurs 0,
kunnr like RF02D-KUNNR,
D0130 like RF02D-D0130,
end of it_kna1.
data : begin of it_kna2 occurs 0,
kunnr like RF02D-KUNNR,
BANKS like KNBK-BANKS,
BANKL like KNBK-BANKL,
BANKN like KNBK-BANKN,
koinh like KNBK-koinh,
end of it_kna2.
data : V_Count(2) type n.
data : V_Val(15).
include bdcrecx1.
start-of-selection.
perform Get_Data1.
perform Get_Data2.
perform open_group.
loop at it_kna1.
V_Count = '04'.
perform bdc_dynpro using 'SAPMF02D' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-D0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
'10002103'.
perform bdc_field using 'RF02D-D0130'
'X'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
loop at it_kna2 where kunnr = it_kna1-kunnr.
if v_count = '10'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
v_count = '00'.
endif.
V_Count = V_Count + 1.
concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.
perform bdc_field using 'BDC_CURSOR'
'KNBK-KOINH(09)'.
concatenate 'KNBK-BANKS(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-BANKS.
concatenate 'KNBK-BANKL(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-BANKL.
concatenate 'KNBK-BANKN(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-BANKN.
concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-KOINH.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_transaction using 'FD02'.
clear : it_kna1,it_kna2.
endloop.
perform close_group.
*& Form Get_Data1
text
--> p1 text
<-- p2 text
FORM Get_Data1 .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\tab_contl.txt'
FILETYPE = 'ASC'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = it_kna1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " Get_Data1
*& Form Get_Data2
text
--> p1 text
<-- p2 text
FORM Get_Data2 .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\tab_cont1.txt'
FILETYPE = 'ASC'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = it_kna2
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " Get_Data2
Thanks & regards
Sreenivasulu P -
BDC program for rebate with table controls
Hi Friends,
Iam Doing bdc program for Rebate(TCODE VBO1) with table controls..
can u give the solutions for table controls...
if anybody having the code..please send me..
Thanks & Advance,
sampathhi,
check this example it may help you.
REPORT ZSR_BDC_TBCTRL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : RF02K,LFA1,LFBK.
DATA : BEGIN OF IT_VEN OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
BANKS(6) TYPE C,
BANKL(17) TYPE C,
BANKN(19) TYPE C,
END OF IT_VEN.
DATA : BEGIN OF BANKS OCCURS 0,
BANKS LIKE LFBK-BANKS,
END OF BANKS,
BEGIN OF BANKL OCCURS 0,
BANKL LIKE LFBK-BANKL,
END OF BANKL,
BEGIN OF BANKN OCCURS 0,
BANKN LIKE LFBK-BANKN,
END OF BANKN.
DATA : FLD(20) TYPE C,
CNT(2) TYPE N.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'Z:\sr.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_VEN
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM OPEN_GROUP.
LOOP AT IT_VEN.
REFRESH BDCDATA.
REFRESH : BANKS,BANKL,BANKN..
SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
IT_VEN-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
IT_VEN-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
IT_VEN-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
IT_VEN-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
IT_VEN-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
IT_VEN-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'LFBK-BANKS(01)'
'DE'.
*perform bdc_field using 'LFBK-BANKS(02)'
'DE'.
*perform bdc_field using 'LFBK-BANKL(01)'
'10020030'.
*perform bdc_field using 'LFBK-BANKL(02)'
'67270003'.
*perform bdc_field using 'LFBK-BANKN(01)'
'12345'.
*perform bdc_field using 'LFBK-BANKN(02)'
'66666'.
MOVE 1 TO CNT.
LOOP AT BANKS.
CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKS-BANKS.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKL.
CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKL-BANKL.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKN.
CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKN-BANKN.
CNT = CNT + 1.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
ENDLOOP.
PERFORM CLOSE_GROUP.&----
*& Report ZSR_BDC_TBCTRL
REPORT ZSR_BDC_TBCTRL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : RF02K,LFA1,LFBK.
DATA : BEGIN OF IT_VEN OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
BANKS(6) TYPE C,
BANKL(17) TYPE C,
BANKN(19) TYPE C,
END OF IT_VEN.
DATA : BEGIN OF BANKS OCCURS 0,
BANKS LIKE LFBK-BANKS,
END OF BANKS,
BEGIN OF BANKL OCCURS 0,
BANKL LIKE LFBK-BANKL,
END OF BANKL,
BEGIN OF BANKN OCCURS 0,
BANKN LIKE LFBK-BANKN,
END OF BANKN.
DATA : FLD(20) TYPE C,
CNT(2) TYPE N.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'Z:\sr.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_VEN
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM OPEN_GROUP.
LOOP AT IT_VEN.
REFRESH BDCDATA.
REFRESH : BANKS,BANKL,BANKN..
SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
IT_VEN-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
IT_VEN-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
IT_VEN-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
IT_VEN-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
IT_VEN-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
IT_VEN-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'LFBK-BANKS(01)'
'DE'.
*perform bdc_field using 'LFBK-BANKS(02)'
'DE'.
*perform bdc_field using 'LFBK-BANKL(01)'
'10020030'.
*perform bdc_field using 'LFBK-BANKL(02)'
'67270003'.
*perform bdc_field using 'LFBK-BANKN(01)'
'12345'.
*perform bdc_field using 'LFBK-BANKN(02)'
'66666'.
MOVE 1 TO CNT.
LOOP AT BANKS.
CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKS-BANKS.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKL.
CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKL-BANKL.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKN.
CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKN-BANKN.
CNT = CNT + 1.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
ENDLOOP.
PERFORM CLOSE_GROUP. -
Wanted a code for table controls in bdc
hi,
i have written code for uploading data into FB60 transaction but i have a serious problem with that code.
after entering 10 line items and when i am entering 11th item it is saying that the screen doesnot contain 11th line.
so please modify my program or if you can please send me a program for handling table controls more line details.
thanks and i will surely provide ten points to it.
my code is
LOOP AT I_PREPARE INTO WA_PREPARE.
V_VALUE = WA_PREPARE-LINE+0(2).
CASE V_VALUE.
WHEN 'A'.
CLEAR:V_DCNT.
*UPLOAD THE COMPANY CODE TO FB60.
*PERFORM.......USING WA_PREPARE-LINE+2(4).
*? filling header data
*********to initialize the company code and to get the popup**********
PERFORM SET_BUKRS.
PERFORM BDC_DYNPRO USING 'SAPLACHD' '1000'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'BKPF-BUKRS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
BUKRS = WA_PREPARE-LINE+2(4).
PERFORM BDC_FIELD USING 'BKPF-BUKRS'
BUKRS.
PERFORM BDC_DYNPRO USING 'SAPMF05A' '1100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF05A-BUSCS'
'R'.
*UPLOAD THE VENDOR NUMBER TO FB60
*PERFORM.......USING WA_PREPARE-LINE+45(10).
ACCNT = WA_PREPARE-LINE+45(10).
PERFORM BDC_FIELD USING 'INVFO-ACCNT'
ACCNT.
*UPLOAD THE DATE TO FB60
WRITE WA_PREPARE-LINE+34(8) TO V_DATE USING EDIT MASK ' . . .'
*PERFORM.......USING V_DATE.
PERFORM BDC_FIELD USING 'INVFO-BLDAT'
'15.09.2004'.
PERFORM BDC_FIELD USING 'INVFO-BUDAT'
'15.09.2004'.
*UPLOAD THE AMOUNT TO FB60
*PERFORM.......USING WA_PREPARE-LINE+85(15).
WRBTR = WA_PREPARE-LINE+85(15).
PERFORM BDC_FIELD USING 'INVFO-WRBTR'
WRBTR.
*UPLOAD THE CURRENCY CODE TO FB60
*PERFORM.......USING WA_PREPARE-LINE+100(3).
WAERS = WA_PREPARE-LINE+100(3).
PERFORM BDC_FIELD USING 'INVFO-WAERS'
WAERS.
WHEN 'D'.
V_DCNT = V_DCNT + 1.
IF V_DCNT GT 04.
V_DCNT = 04.
ENDIF.
*UPLOAD THE G/L ACC. TO FB60.
*PERFORM.......USING WA_PREPARE-LINE+51(20).
*? filling item data
CONCATENATE 'ACGL_ITEM-WRBTR(' V_DCNT ')' INTO FNAM.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
FNAM.
CONCATENATE 'ACGL_ITEM-HKONT(' V_DCNT ')' INTO FNAM.
HKONT = WA_PREPARE-LINE+51(20).
PERFORM BDC_FIELD USING FNAM
HKONT.
*UPLOAD THE AMOUNT TO FB60(ACGL_ITEM-WRBTR)
*PERFORM........USING WA_PREPARE-LINE+121(15).
CONCATENATE 'ACGL_ITEM-WRBTR(' V_DCNT ')' INTO FNAM.
WRBTR = WA_PREPARE-LINE+75(15).
PERFORM BDC_FIELD USING FNAM
WRBTR.
PERFORM BDC_DYNPRO USING 'SAPMF05A' '1100'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=0006'.
PERFORM BDC_FIELD USING 'RF05A-BUSCS'
'R'.
ENDCASE.hi,
check this example:
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
REPORT ZSR_BDC_TBCTRL
NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES : RF02K,LFA1,LFBK.
DATA : BEGIN OF IT_VEN OCCURS 0,
LIFNR LIKE RF02K-LIFNR,
KTOKK LIKE RF02K-KTOKK,
NAME1 LIKE LFA1-NAME1,
SORTL LIKE LFA1-SORTL,
LAND1 LIKE LFA1-LAND1,
SPRAS LIKE LFA1-SPRAS,
BANKS(6) TYPE C,
BANKL(17) TYPE C,
BANKN(19) TYPE C,
END OF IT_VEN.
DATA : BEGIN OF BANKS OCCURS 0,
BANKS LIKE LFBK-BANKS,
END OF BANKS,
BEGIN OF BANKL OCCURS 0,
BANKL LIKE LFBK-BANKL,
END OF BANKL,
BEGIN OF BANKN OCCURS 0,
BANKN LIKE LFBK-BANKN,
END OF BANKN.
DATA : FLD(20) TYPE C,
CNT(2) TYPE N.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
INCLUDE BDCRECX1.
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'Z:\sr.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = IT_VEN
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM OPEN_GROUP.
LOOP AT IT_VEN.
REFRESH BDCDATA.
REFRESH : BANKS,BANKL,BANKN..
SPLIT IT_VEN-BANKS AT ',' INTO TABLE BANKS.
SPLIT IT_VEN-BANKL AT ',' INTO TABLE BANKL.
SPLIT IT_VEN-BANKN AT ',' INTO TABLE BANKN.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0100'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'RF02K-KTOKK'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'RF02K-LIFNR'
IT_VEN-LIFNR.
PERFORM BDC_FIELD USING 'RF02K-KTOKK'
IT_VEN-KTOKK.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0110'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-SPRAS'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_FIELD USING 'LFA1-NAME1'
IT_VEN-NAME1.
PERFORM BDC_FIELD USING 'LFA1-SORTL'
IT_VEN-SORTL.
PERFORM BDC_FIELD USING 'LFA1-LAND1'
IT_VEN-LAND1.
PERFORM BDC_FIELD USING 'LFA1-SPRAS'
IT_VEN-SPRAS.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0120'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFA1-KUNNR'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'/00'.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKN(02)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
*perform bdc_field using 'LFBK-BANKS(01)'
'DE'.
*perform bdc_field using 'LFBK-BANKS(02)'
'DE'.
*perform bdc_field using 'LFBK-BANKL(01)'
'10020030'.
*perform bdc_field using 'LFBK-BANKL(02)'
'67270003'.
*perform bdc_field using 'LFBK-BANKN(01)'
'12345'.
*perform bdc_field using 'LFBK-BANKN(02)'
'66666'.
MOVE 1 TO CNT.
LOOP AT BANKS.
CONCATENATE 'LFBK-BANKS(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKS-BANKS.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKL.
CONCATENATE 'LFBK-BANKL(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKL-BANKL.
CNT = CNT + 1.
ENDLOOP.
MOVE 1 TO CNT.
LOOP AT BANKN.
CONCATENATE 'LFBK-BANKN(' CNT ') ' INTO FLD.
PERFORM BDC_FIELD USING FLD BANKN-BANKN.
CNT = CNT + 1.
ENDLOOP.
PERFORM BDC_DYNPRO USING 'SAPMF02K' '0130'.
PERFORM BDC_FIELD USING 'BDC_CURSOR'
'LFBK-BANKS(01)'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=ENTR'.
PERFORM BDC_DYNPRO USING 'SAPLSPO1' '0300'.
PERFORM BDC_FIELD USING 'BDC_OKCODE'
'=YES'.
PERFORM BDC_TRANSACTION USING 'XK01'.
ENDLOOP.
PERFORM CLOSE_GROUP. -
How to give line items in flatfile while doing BDC for Table control
Hi all,
I am writing BDC for Multiple line items and Transaction is : FSE5N.
How do i give the data in the flat file. I mean how do we give the multiple line items in flat file , i.e for second line item again we have to header data or not ?
ex:
1015;ALL;demo;kr;INR;01;0001;3000172;100
1015;ALL;demo;kr;INR;01;0001;3000172;200
for first lineitem : 3000172;100
for 2nd line item : 3000172; 200.
header data : 1015;ALL;demo;kr;INR;01;0001.
Thanks in advance
krupaliHii ,
u can give in the same format as u have done in the example.
A B C D E F G H I
1015;ALL;demo;kr;INR;01;0001;3000172;100
1015;ALL;demo;kr;INR;01;0001;3000172;200
and while writing the loop u can give
loop at it_head.
loop at it_head where a = it_head-A and b = it_head-B ..........upto G = it_head-G.
endloop.
endloop.
check this
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
Neeraj -
Function module for table control
Hi experts,
I am creating the BDC program, In that I need to select the particular item from the table control say for example item 0010 or 0020 based on the input file and need to process from there.
Is there any function module to select the particular item by passing item no say 0010 or 0020.
Thanks in advance
saiHi
I suppose there is no function module for table control.
below solution might be useful to you.
1) Do BDC recording for the table control with each condition you would like to incorporate in your program.
2) copy the code of Table Control recording in your program and place the code in Loop of internal table.
3) based on the condition call the respective BDC recording of the table control
4) By the above steps you can manage the table control based on the condition.
Regards
Santosh Kumaar.M -
How to create a BDC program for given recording.
i have to create a BDC program for uploading a file.
currently i am using call function
CALL FUNCTION 'F4_FILENAME'just check out the code below it is for updating two transactions
types Declaration *
types: begin of t_tab1 ,
vendor(10),
material(18),
pur_org(4),
wglif(18),
end of t_tab1.
Data Declaration *
data : begin of it_tab5 occurs 0,
vendor(10),
material(18),
end of it_tab5.
**DATA : BEGIN OF IT_TAB6 OCCURS 0,
VENDOR(10),
MATERIAL(18),
END OF IT_TAB6.
data: it_tab1 type standard table of t_tab1 with header line.
data: wa_tab1 type t_tab1.
data: wa_tab2 type t_tab1.
data: it_tab3 like bdcdata occurs 0 with header line.
data: it_tab4 like bdcdata occurs 0 with header line.
data: it_tab2 type table of bdcmsgcoll with header line.
data: d_file_name like ibipparms-path,
d_file_name1 type string.
Start-of-selection *
start-of-selection.
FM for finding the flat file
call function 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
importing
file_name = d_file_name.
d_file_name1 = d_file_name.
******FM for uploading data from flat file into internal table
call function 'GUI_UPLOAD'
exporting
filename = d_file_name1
filetype = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = it_tab5
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
End-of-selection *
end-of-selection.
sort it_tab5 by vendor.
loop at it_tab5.
perform bdc_dynpro using 'SAPLBG00' 0101 .
perform bdc_field using 'BDC_OKCODE' '/00' .
perform bdc_dynpro using 'SAPLBG00' 1000 .
perform bdc_field using 'BDC_OKCODE' '=BUCH' .
perform bdc_field using 'BDC_SUBSCR'
'SAPLBG00 1101KOPF_1000'.
perform bdc_field using 'GBGMK-GAART' '2' .
perform bdc_field using 'GBGMK-GAERB' 'X' .
perform bdc_field using 'BDC_SUBSCR'
'SAPLBG00 1103TAB_SUB_1000'.
perform bdc_field using 'BDC_CURSOR' 'GBGMP-LSTNR(01)' .
perform bdc_field using 'GBGMP-LSTNR(01)' it_tab5-material .
call transaction 'BGM1' using it_tab3 mode 'E' messages into it_tab2
refresh it_tab3.
wa_tab1-pur_org = 'ABCP'.
loop at it_tab2.
endloop.
perform bdc_dynpro using 'SAPMM06I' 0100 .
perform bdc_field using 'BDC_CURSOR' 'EINE-EKORG' .
perform bdc_field using 'BDC_OKCODE' '/00' .
perform bdc_field using 'EINA-LIFNR' it_tab5-vendor .
perform bdc_field using 'EINA-MATNR' it_tab5-material .
perform bdc_field using 'EINE-EKORG' wa_tab1-pur_org .
perform bdc_field using 'RM06I-NORMB' 'X' .
perform bdc_dynpro using 'SAPMM06I' 0101 .
perform bdc_field using 'BDC_CURSOR' 'EINA-WGLIF' .
perform bdc_field using 'BDC_OKCODE' '=BU' .
perform bdc_field using 'EINA-WGLIF' it_tab2-msgv1 .
call transaction 'ME12' using it_tab3 mode 'E'.
refresh it_tab3.
refresh it_tab2.
endloop.
*& Form BDC_DYNPRO
Start new screen
-->P_FNAM text
-->P_FVAL text
form bdc_dynpro using program
dynpro.
clear it_tab3.
it_tab3-program = program.
it_tab3-dynpro = dynpro.
it_tab3-dynbegin = 'X'.
append it_tab3.
endform. " BDC_DYNPRO
*& Form BDC_FIELD
Insert field
-->P_FNAM text
-->P_FVAL text
form bdc_field using fnam
fval.
clear it_tab3.
it_tab3-fnam = fnam.
it_tab3-fval = fval.
append it_tab3.
endform. " BDC_FIELD
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Apr 14, 2008 6:20 PM -
Screen Variant for table control in FB60
Hi ,
I need to create variant to show Quantity and Base Unit of Measure columns in the table control which is available at the first screen of FB60 . I tried using the option screen variant - > create variant. i couldnt see the options of colmuns properties for table control on click that small icon available at the right conner. Pls guide.
ThanksIn transaction SHD0 you need to create a new variant.
After that you will be taken into FB60.
Press Enter as if you are trying to process vendor invoice. It will take you to a screen "Screen values 1100 Program SAPMF05A"
There you will have 3 columns Output only, Invisible and Mandatory.
Select as you want.
Just try out carefully, you will be able to get the desired result.
It is very difficult to guide you in details.
Please let me know if you face any problems.
Rgds,
Harmees -
What is the bdc program for vendor master?
what is the bdc program for vendor master?
Hi,
Find the code here.
And do create your text file data in the order of itab structure.
{report ZBDC_XK01
no standard page heading line-size 255.
data: bdcdata like bdcdata occurs 0 with header line.
data: begin of itab occurs 0,
lifnr like lfa1-lifnr,
bukrs like RF02K-bukrs,
ekorg like RF02K-ekorg,
ktokk like RF02K-ktokk,
anred like lfa1-anred,
name1 like lfa1-name1,
sortl like lfa1-sortl,
land1 like lfa1-land1,
spras like lfa1-spras,
waers like lfm1-waers,
end of itab.
selection-screen begin of block blk1 with frame.
parameters: p_file like rlgrap-filename OBLIGATORY.
selection-screen end of block blk1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
perform f4_help_p_file.
start-of-selection.
perform get_data.
perform upload.
END-OF-SELECTION.
*& Form f4_help_p_file
text
--> p1 text
<-- p2 text
form f4_help_p_file .
data: v_file like p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = v_file.
CHECK sy-subrc EQ 0.
p_file = v_file.
endform. " f4_help_p_file
*& Form get_data
text
--> p1 text
<-- p2 text
form get_data .
data: s_file type string.
s_file = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = s_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'D'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
stop.
ENDIF.
endform. " get_data
*& Form upload
text
--> p1 text
<-- p2 text
form upload .
loop at itab.
perform bdc_dynpro using 'SAPMF02K' '0100'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-KTOKK'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02K-LIFNR' itab-lifnr.
perform bdc_field using 'RF02K-BUKRS' '0001'.
perform bdc_field using 'RF02K-EKORG' '1000'.
perform bdc_field using 'RF02K-KTOKK' '0001'.
perform bdc_dynpro using 'SAPMF02K' '0110'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-SPRAS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFA1-ANRED' itab-anred.
perform bdc_field using 'LFA1-NAME1' itab-name1.
perform bdc_field using 'LFA1-SORTL' itab-sortl.
perform bdc_field using 'LFA1-LAND1' itab-land1.
perform bdc_field using 'LFA1-SPRAS' itab-spras.
perform bdc_dynpro using 'SAPMF02K' '0120'.
perform bdc_field using 'BDC_CURSOR'
'LFA1-KUNNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0130'.
perform bdc_field using 'BDC_CURSOR'
'LFBK-BANKS(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPMF02K' '0210'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-AKONT'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0215'.
perform bdc_field using 'BDC_CURSOR'
'LFB1-ZTERM'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0220'.
perform bdc_field using 'BDC_CURSOR'
'LFB5-MAHNA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPMF02K' '0310'.
perform bdc_field using 'BDC_CURSOR'
'LFM1-WAERS'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'LFM1-WAERS' itab-waers.
perform bdc_dynpro using 'SAPMF02K' '0320'.
perform bdc_field using 'BDC_CURSOR'
'RF02K-LIFNR'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
call transaction 'XK01' using bdcdata mode 'A'.
refresh bdcdata.
clear itab.
endloop.
endform. " upload
*& Form bdc_dynpro
text
-->P_0126 text
-->P_0127 text
form bdc_dynpro using program dynpro.
clear bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
append bdcdata.
endform. " bdc_dynpro
*& Form bdc_field
text
-->P_0316 text
-->P_0317 text
form bdc_field using fnam fval.
clear bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
append bdcdata.
endform. " bdc_field}
Reward points if you find it helpful
Thanks,
Prasanna -
Need to write BDC program for Transaction VA01(Sales order creation)
Dear Friends,
I need to write a BDC program for uploading data into sap from an excel sheet file. The data contain Material Description,Customer Name,Date of Delivery,Quantity,Unit of measure etc.
material desc customer date of delivery quantity unit of measure
abcdf xyz ltd 24.12.2011 2 4 gm
The transaction is VA01.How will I find the correct fields and related tables? What are the related fields needed in the transaction VA01.
Thanking you
Sacheen Pukhrambam
Moderator Message: Put some self-effort before posting your question. Thread locked.
Edited by: Suhas Saha on Nov 25, 2011 1:25 PMHello,
You could try using a BDC with VL04 but first preference would be to see if there are any BAPI functions (search for BAPI) that can do this.
If BUS2032 doesn't have an attribute that you want (eg shipping point) then sub-delegate to ZBUS2032 and add the attribute, it's straightforward. You just have to know how to determine the value programmatically.
regards
Rick Bakker
hanabi technology -
BDC program for Other Goods receipts
Hi all,
I need BDC program for Other goods receipts,
I have data in excel like material, batch id, qty, actual width, length, plant etc. i want to upload this in one short based on the movement type.
Thanks in advance.
ShankarHi MP Shankar,
This is a sample BDC program .Use the format to develop your own BDC program.First record your trasnaction and use that recorded program here.Pass your filename here.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_ifile TYPE dxfile-filename.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-002.
PARAMETERS: p_sess RADIOBUTTON GROUP g3 "create session
DEFAULT 'X' USER-COMMAND bdc,
p_ctu RADIOBUTTON GROUP g3. "call transaction
SELECTION-SCREEN END OF BLOCK b3.
DATA : BEGIN OF itab OCCURS 0,
str TYPE string,
END OF itab,
l_file TYPE string,
t_bdcdata TYPE STANDARD TABLE OF bdcdata,
wa_bdcdata LIKE LINE OF t_bdcdata.
AT SELECTION SCREEN ON VALUE REQUEST
Value request for the filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_ifile.
PERFORM help_input_file.
START-OF-SELECTION.
CLEAR l_file.
l_file = p_ifile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
*Start new session
IF p_sess = 'X'.
PERFORM bdc_open.
ENDIF.
LOOP AT itab.
PERFORM creat_batch_input.
PERFORM bdc_insert.
IF p_ctu = 'X'.
CALL TRANSACTION 'SE38' USING t_bdcdata MODE 'A'.
ENDIF.
ENDLOOP.
IF p_sess = 'X'.
PERFORM bdc_close .
ENDIF.
*& Form bdc_open
text
--> p1 text
<-- p2 text
FORM bdc_open .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'ZMUK'
user = sy-uname
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
ENDFORM. " bdc_open
*& Form creat_batch_input
text
--> p1 text
<-- p2 text
FORM creat_batch_input .
use your own recorded program here.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=STRT'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
itab-str.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
PERFORM bdc_dynpro USING 'SAPLSLVC_FULLSCREEN' '0500'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=&F03'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
itab-str.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
ENDFORM. " creat_batch_input
*& Form bdc_insert
text
--> p1 text
<-- p2 text
FORM bdc_insert .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'SE38'
TABLES
dynprotab = t_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
ENDFORM. " bdc_insert
*& Form bdc_dynpro
text
-->P_0168 text
-->P_0169 text
FORM bdc_dynpro USING p_program TYPE any
p_dynpro TYPE any.
CLEAR wa_bdcdata.
wa_bdcdata-program = p_program.
wa_bdcdata-dynpro = p_dynpro.
wa_bdcdata-dynbegin = 'X'.
APPEND wa_bdcdata TO t_bdcdata.
ENDFORM. " bdc_dynpro
*& Form bdc_field
text
-->P_0179 text
-->P_0180 text
FORM bdc_field USING p_fnam TYPE any
p_fval TYPE any.
CLEAR wa_bdcdata.
wa_bdcdata-fnam = p_fnam.
wa_bdcdata-fval = p_fval.
CONDENSE wa_bdcdata-fval.
APPEND wa_bdcdata TO t_bdcdata.
ENDFORM. " bdc_field
*& Form bdc_close
text
--> p1 text
<-- p2 text
FORM bdc_close .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
ENDFORM. " bdc_close
*& Form help_input_file
text
--> p1 text
<-- p2 text
FORM help_input_file .
DATA: lt_file_table TYPE filetable,
la_file_table LIKE LINE OF lt_file_table,
l_rc TYPE i,
l_pcdsn TYPE cffile-filename.
REFRESH lt_file_table.
CLEAR la_file_table.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_file_table
rc = l_rc.
READ TABLE lt_file_table INTO la_file_table INDEX 1.
l_pcdsn = la_file_table-filename.
MOVE l_pcdsn TO p_ifile.
ENDFORM. " help_input_file -
Hi ,
i have written a bdc program for f-02 .here we have 2 posting keys 31 and 40 .when i recored in shdb i can see when i use 31 posting key then i get 302 screen and when i use 40 posting key then i get 300 screen.But the problem is in 302 screen we have new posting keys and new account numbers .how to update these . here is my code . my file is not getting updated when i get screen 302 .Any advice?
REPORT zfip0009 NO STANDARD PAGE HEADING.
TABLES ska1.
DATA: BEGIN OF bdcdata OCCURS 0.
INCLUDE STRUCTURE bdcdata.
DATA: END OF bdcdata.
DATA w_date(10) TYPE c.
DATA w_first TYPE c.
DATA w_second TYPE c.
data from flat file
DATA: BEGIN OF t_data OCCURS 0,
bukrs LIKE bkpf-bukrs, "company code
newbs LIKE rf05a-newbs, "Posting Key
newko LIKE rf05a-newko, "New account number(SAP)
wrbtr(13) TYPE c, "amount
dmbtr(13) TYPE c, "sterling local amount "+MW1
mwskz LIKE bseg-mwskz, "Tax code
sgtxt LIKE bseg-sgtxt, "item description
kostl LIKE cobl-kostl, "Cost centre
ps_posid LIKE cobl-ps_posid, "WBS number
aufnr LIKE cobl-aufnr, "Internal order
END OF t_data.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename
DEFAULT 'C:\temp\XSL.txt'.
SELECTION-SCREEN SKIP.
PARAMETERS: p_sess(12) DEFAULT 'GLPOSTING'.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: p_bldat LIKE bkpf-bldat,
p_budat LIKE bkpf-budat,
p_blart LIKE bkpf-blart,
p_monat LIKE bkpf-monat,
p_bukrs LIKE bkpf-bukrs,
p_bktxt LIKE bkpf-bktxt,
p_xblnr LIKE bkpf-xblnr,
p_waers LIKE bkpf-waers.
SELECTION-SCREEN END OF BLOCK b2.
*SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
*PARAMETERS p_ktopl LIKE ska1-ktopl.
*SELECTION-SCREEN END OF BLOCK b3.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_file
DEF_PATH = ' '
mask = ',.,..'
MODE = ' '
TITLE = ' '
IMPORTING
filename = p_file
RC =
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
START OF SELECTION
START-OF-SELECTION.
Get all of the information held on the spreadsheets.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = t_data
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
WRITE :/ 'Failed to Open Input file', p_file.
EXIT.
ENDIF.
REFRESH bdcdata.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = p_sess
user = sy-uname
keep = 'X'.
PERFORM load_bdcdata.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
WRITE: /
'Batch input session', p_sess, 'created: process session via SM35'.
END-OF-SELECTION.
*& Form LOAD_BDCDATA
Load the BDCDATA fields depending
FORM load_bdcdata.
CLEAR: w_first, w_second.
CLEAR bdcdata.
LOOP AT t_data.
IF sy-tabix = 1.
PERFORM bdc_dynpro USING 'SAPMF05A' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM format_date USING p_bldat.
PERFORM bdc_field USING 'BKPF-BLDAT'
w_date.
PERFORM bdc_field USING 'BKPF-BLART'
p_blart.
PERFORM bdc_field USING 'BKPF-BUKRS'
t_data-bukrs.
PERFORM format_date USING p_budat.
PERFORM bdc_field USING 'BKPF-BUDAT'
w_date.
PERFORM bdc_field USING 'BKPF-WAERS'
p_waers.
PERFORM bdc_field USING 'BKPF-MONAT'
PERFORM bdc_field USING 'BKPF-BKTXT'
p_bktxt.
PERFORM bdc_field USING 'BKPF-XBLNR'
p_xblnr.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_data-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_data-newko.
ELSE.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_data-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_data-newko.
PERFORM bdc_field USING 'RF05A-NEWBK'
t_data-bukrs.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_OKCODE' 'ENTE'.
ENDIF.
IF t_data-newbs = '31' .
w_second = '1'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_data-wrbtr.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_data-sgtxt.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_data-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_data-newko.
IF NOT t_data-kostl IS INITIAL.
PERFORM bdc_field USING 'COBL-KOSTL'
t_data-kostl.
ELSEIF NOT t_data-ps_posid IS INITIAL.
PERFORM bdc_field USING 'COBL-PS_POSID'
t_data-ps_posid.
ELSEIF NOT t_data-aufnr IS INITIAL.
PERFORM bdc_field USING 'COBL-AUFNR'
t_data-aufnr.
ENDIF.
*...start of Amendment MW1
IF p_waers ne 'GBP'.
PERFORM bdc_field USING 'BSEG-DMBTR'
t_data-dmbtr.
ENDIF.
ENDIF.
*...end of Amendment MW1 ENDIF.
IF t_data-newbs = '40' .
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_data-wrbtr.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_data-sgtxt.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_OKCODE' 'ENTE'.
IF NOT t_data-kostl IS INITIAL.
PERFORM bdc_field USING 'COBL-KOSTL'
t_data-kostl.
ELSEIF NOT t_data-ps_posid IS INITIAL.
PERFORM bdc_field USING 'COBL-PS_POSID'
t_data-ps_posid.
ELSEIF NOT t_data-aufnr IS INITIAL.
PERFORM bdc_field USING 'COBL-AUFNR'
t_data-aufnr.
ENDIF.
PERFORM bdc_field USING 'BSEG-MWSKZ'
t_data-mwskz.
*...start of Amendment MW1
IF p_waers ne 'GBP'.
PERFORM bdc_field USING 'BSEG-DMBTR'
t_data-dmbtr.
ENDIF.
*...end of Amendment MW1
ENDIF.
AT FIRST.
calculate the tax
PERFORM bdc_field USING 'BKPF-XMWST' 'X'.
ENDAT.
IF t_data-newbs = '40' .
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_OKCODE'
'ENTE'.
IF NOT t_data-kostl IS INITIAL.
PERFORM bdc_field USING 'COBL-KOSTL'
t_data-kostl.
ELSEIF NOT t_data-ps_posid IS INITIAL.
PERFORM bdc_field USING 'COBL-PS_POSID'
t_data-ps_posid.
ELSEIF NOT t_data-aufnr IS INITIAL.
PERFORM bdc_field USING 'COBL-AUFNR'
t_data-aufnr.
ENDIF.
ENDIF.
ENDLOOP.
IF w_second = '1'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
ELSE.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
ENDIF.
PERFORM bdc_field USING 'BDC_OKCODE'
'BU'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-WRBTR'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_OKCODE'
'ENTE'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'F-02'
TABLES
dynprotab = bdcdata.
REFRESH bdcdata.
CLEAR bdcdata.
ENDFORM. " LOAD_BDCDATA
Start of screen
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
insert field
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
*& Form format_date
text
FORM format_date USING p_date.
CLEAR w_date.
w_date(2) = p_date+6(2).
w_date+2(1) = '.'.
w_date3(2) = p_date4(2).
w_date+5(1) = '.'.
w_date+6(4) = p_date(4).
ENDFORM. " format_dateIF item-newbs = '09'
OR item-newbs = '19'
OR item-newbs = '29'
OR item-newbs = '39'.
IF item-newum = 'A' OR
item-newum = 'V' OR
item-newum = '1' OR
item-newum = '2' OR
item-newum = '3' OR
item-newum = '5' OR
item-newum = '6' OR
item-newum = 'B' .
PERFORM bdc_dynpro USING 'SAPMF05A' '0304'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWUM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'BSEG-gsber'
item-gsber.
PERFORM bdc_field USING 'BSEG-PRCTR'
item-prctr.
PERFORM bdc_field USING 'BSEG-ZFBDT'
item-zfbdt1.
PERFORM bdc_field USING 'BSEG-ZUONR'
item-zuonr.
PERFORM bdc_field USING 'BSEG-SGTXT'
item-sgtxt.
IF idx1 = '002' .
EXIT.
ENDIF.
idx = idx + 1.
READ TABLE item INDEX idx .
PERFORM bdc_field USING 'RF05A-NEWBS'
item-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
item-newko.
PERFORM bdc_field USING 'RF05A-NEWUM'
item-newum.
PERFORM bdc_field USING 'RF05A-NEWBW'
item-newbw.
CONTINUE.
ENDIF.
ENDIF.
IF item-newbs = '09'
OR item-newbs = '19'
OR item-newbs = '29'
OR item-newbs = '39' .
IF item-newum = 'H'
OR item-newum = '4'
OR item-newum = '6'
OR item-newum = '7'
OR item-newum = '8'
OR item-newum = '9'
OR item-newum = 'C'
OR item-newum = 'D'
OR item-newum = 'E'
OR item-newum = 'I'
OR item-newum = 'K'
OR item-newum = 'L'
OR item-newum = 'M'
OR item-newum = 'O'
OR item-newum = 'Q'
OR item-newum = 'R'
OR item-newum = 'T'
OR item-newum = 'U'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'BSEG-GSBER'
item-gsber.
PERFORM bdc_field USING 'BSEG-ZFBDT'
item-zfbdt1.
PERFORM bdc_field USING 'BSEG-ZUONR'
item-zuonr.
PERFORM bdc_field USING 'BSEG-SGTXT'
item-sgtxt.
IF idx1 = '002' .
EXIT.
ENDIF.
idx = idx + 1 .
READ TABLE item INDEX idx .
PERFORM bdc_field USING 'RF05A-NEWBS'
item-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
item-newko.
PERFORM bdc_field USING 'RF05A-NEWUM'
item-newum.
PERFORM bdc_field USING 'RF05A-NEWBW'
item-newbw.
CONTINUE.
ENDIF.
ENDIF.
IF item-newbs = '29' OR item-newbs = '39'.
IF item-newum = '7'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0303'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-ZFBDT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ZK'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'BSEG-GSBER'
item-gsber.
PERFORM bdc_field USING 'BSEG-ZFBDT'
item-zfbdt1.
PERFORM bdc_field USING 'BSEG-ZUONR'
item-zuonr.
PERFORM bdc_field USING 'BSEG-SGTXT'
item-sgtxt.
PERFORM bdc_dynpro USING 'SAPMF05A' '0332'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-BEWAR'
item-ttype.
IF idx1 = '002' .
EXIT.
ENDIF.
idx = idx + 1 .
READ TABLE item INDEX idx .
PERFORM bdc_field USING 'RF05A-NEWBS'
item-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
item-newko.
PERFORM bdc_field USING 'RF05A-NEWUM'
item-newum.
PERFORM bdc_field USING 'RF05A-NEWBW'
item-newbw.
CONTINUE.
ENDIF.
ENDIF.
IF item-newbs = '01' OR item-newbs = '11'
OR item-newbs = '05' OR item-newbs = '15'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'BSEG-GSBER'
item-gsber.
PERFORM bdc_field USING 'BSEG-ZTERM'
item-zterm.
PERFORM bdc_field USING 'BSEG-ZFBDT'
item-zfbdt.
PERFORM bdc_field USING 'BSEG-ZUONR'
item-zuonr.
PERFORM bdc_field USING 'BSEG-SGTXT'
item-sgtxt.
IF idx1 = '002' .
EXIT.
ENDIF.
idx = idx + 1 .
READ TABLE item INDEX idx .
PERFORM bdc_field USING 'RF05A-NEWBS'
item-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
item-newko.
PERFORM bdc_field USING 'RF05A-NEWUM'
item-newum.
PERFORM bdc_field USING 'RF05A-NEWBW'
item-newbw.
CONTINUE.
ENDIF.
IF item-newbs = '21' OR item-newbs = '31'
OR item-newbs = '25' OR item-newbs = '35'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'BSEG-SECCO'
''. "'1000'.
PERFORM bdc_field USING 'BSEG-GSBER'
item-gsber.
PERFORM bdc_field USING 'BSEG-ZTERM'
item-zterm.
PERFORM bdc_field USING 'BSEG-ZFBDT'
item-zfbdt.
PERFORM bdc_field USING 'BSEG-ZUONR'
item-zuonr.
PERFORM bdc_field USING 'BSEG-SGTXT'
item-sgtxt.
IF idx1 = '002' .
EXIT.
ENDIF.
idx = idx + 1.
READ TABLE item INDEX idx.
PERFORM bdc_field USING 'RF05A-NEWBS'
item-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
item-newko.
PERFORM bdc_field USING 'RF05A-NEWUM'
item-newum.
PERFORM bdc_field USING 'RF05A-NEWBW'
item-newbw.
CONTINUE.
ENDIF.
IF item-newbs = '70' OR item-newbs = '75'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0305'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-WRBTR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-PRCTR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
item-gsber.
PERFORM bdc_field USING 'COBL-KOSTL'
item-kostl.
PERFORM bdc_field USING 'COBL-PRCTR'
item-prctr.
PERFORM bdc_dynpro USING 'SAPMF05A' '0305'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWBW'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
item-wrbtr.
PERFORM bdc_field USING 'BSEG-BZDAT'
'01.04.2005'.
IF idx1 = '002' .
EXIT.
ENDIF.
idx = idx + 1 .
READ TABLE item INDEX idx .
PERFORM bdc_field USING 'RF05A-NEWBS'
item-newbs.
PERFORM bdc_field USING 'RF05A-NEWKO'
item-newko.
PERFORM bdc_field USING 'RF05A-NEWUM'
item-newum.
PERFORM bdc_field USING 'RF05A-NEWBW'
item-newbw.
CONTINUE.
ENDIF.
ENDLOOP.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_transaction USING 'F-02'.
DELETE item INDEX 1.
DELETE item INDEX 1.
ix = ix + 2 .
ENDDO.
PERFORM close_group.
Maybe you are looking for
-
Hello! Attached is a simple VI that uses the IWebBrowser2 (ActiveX) control to display an xls file. The problem is that I need to access the IWebBrowser.Document property, but that causes Excel to stay open. Run the VI with boolean=False and Ex
-
Table data in Indesign - XML, Excel or other?
Hi We are setting up a document that will include a lot of tables for a range of different products. The last 2 columns in the tables are for prices and delivery. We need to be able to increase the prices in the Indesign tables easily as and when we
-
How to setup vlans and routing between them
Hey guys I am onboard a vessel where I have a Cisco 1921 router with intergrated 8-port dwitch. I have no experince what so ever with Cisco, onlye knowledge about netwrok in general. What I need to do is to create 3 VLANs wit different networks and t
-
Delivery date on the sales order
Hi frnds I am facing an issue here. When the sales order comes of credit hold the system proposes a new delivery date in the sales order. How can i change the settings to avoid the system from assigning weekends(Saturday & Sunday) as the delivery dat
-
8220 and software v. 4.6 issues
I recently had a JUM/JVM 545 error and had to reinstall my BB's software. I installed the newer 4.6.0.180 software for the phone which was reccommeded by my desktop manager software for the Mac. Since the upgrade I have had a few issures I would li