Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

help with example bdc program

Former Member
0 Kudos
118

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
88

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

6 REPLIES 6

former_member404244
Active Contributor
0 Kudos
88

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

Former Member
0 Kudos
89

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

0 Kudos
88

hi

You are missing refresh bdcdata after append bdcdata.

Former Member
0 Kudos
88

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.

Former Member
0 Kudos
88

Thanks..

former_member404244
Active Contributor
0 Kudos
88

Hi sundar,

u didn't give points to anyone..

plz reward all helpful answers.

Regards,

Nagaraj