2007 Aug 24 10:39 AM
Hi,
I have created 5 rows in the flat file. When I run the bdc program in 'A' mode, it runs 5 times but everytime it is processing the first row only. pls tell me why it is processing the same line.
thanks and regards,
-
report ZID3
no standard page heading line-size 255.
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
TYPES : begin of matl,
matnr type matnr,
maktx type maktx,
meins type meins,
end of matl.
Data: table1 type standard table of matl,
wa_itab type matl.
selection-screen begin of block b1 with frame.
parameters : p_fname like rlgrap-filename default 'C:\mat.txt'.
selection-screen end of block b1.
at selection-screen .
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\mat.txt'
FILETYPE = 'DAT'
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 = table1
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.
LOOP AT table1 INTO WA_ITAB.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'=AUSW'.
perform bdc_field using 'RMMG1-MATNR'
wa_itab-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_field using 'MSICHTAUSW-KZSEL(02)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
wa_itab-maktx.
perform bdc_field using 'MARA-MEINS'
wa_itab-meins.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'MAKT-MAKTX'.
perform bdc_field using 'MAKT-MAKTX'
wa_itab-maktx.
call transaction 'MM02' using bdcdata mode 'a' update 'L'.
clear wa_itab.
endloop.
----
Start new screen *
----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
----
Insert field *
----
FORM BDC_FIELD USING FNAM FVAL.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDFORM.
-
flat file mat.txt-------
171 test1 EA test1
172 test2 EA test2
173 test3 ea test3
174 test4 ea test4
175 test5 ea test5
2007 Aug 24 10:45 AM
Hi Sundar,
Refresh your bdcdata after each CALL TRANSACTION in the LOOP,,,ENDLOOP.
Check this code.
<b>call transaction 'MM02' using bdcdata mode 'A' update 'L'.</b>
<b>REFRESH BDCDATA[].</b>
Thanks,
Vinay
2007 Aug 24 10:43 AM
Hi ,
U have to refresh the BDCDATA after ur call transaction.Do like this
call transaction 'MM02' using bdcdata mode 'a' update 'L'.
refresh : bdcdata.
regards,
Nagaraj
2007 Aug 24 10:45 AM
Hi Sundar,
Refresh your bdcdata after each CALL TRANSACTION in the LOOP,,,ENDLOOP.
Check this code.
<b>call transaction 'MM02' using bdcdata mode 'A' update 'L'.</b>
<b>REFRESH BDCDATA[].</b>
Thanks,
Vinay
2007 Aug 24 10:49 AM
2007 Aug 24 10:50 AM
hi ,
u r not refreshing, thats why its uploading the same record.use
call transaction 'MM02' using bdcdata mode 'a' update 'L'.
<b>refresh wa_itab</b>
clear wa_itab.
endloop.
2007 Aug 24 10:58 AM
2007 Aug 24 11:07 AM
Hi sundar,
u didn't give points to anyone..
plz reward all helpful answers.
Regards,
Nagaraj