02-10-2017 1:51 PM
Hi all
I have made an bdc using call transaction, i am getting data on first screen ,but when next screen comes , i am getting only single line item data.But when i press back then again enter then next index comes on screen, in this way i get all data one by one but i want data once at a time for example multiple line items at a one click.please check below code .
loop at it_ff67 into wa_ff67.
wa_header-bukrs = wa_ff67-bukrs.
wa_header-hbkid = wa_ff67-hbkid.
wa_header-hktid = wa_ff67-hktid.
wa_header-aznum = wa_ff67-aznum.
wa_header-azdat = wa_ff67-azdat.
wa_header-ssald = wa_ff67-ssald.
wa_header-esald = wa_ff67-esald.
wa_header-austg_ds = wa_ff67-austg_ds.
wa_header-budtm = wa_ff67-budtm.
wa_header-vgman = wa_ff67-vgman.
wa_header-kwbtr = wa_ff67-kwbtr.
wa_header-valut = wa_ff67-valut.
wa_header-zuonr = wa_ff67-zuonr.
wa_header-index = wa_ff67-index.
append wa_header to it_header.
endloop.
loop at it_ff67 into wa_ff67.
wa_ff67a-index = wa_ff67-index.
wa_ff67a-vgman = wa_ff67-vgman.
wa_ff67a-valut = wa_ff67-valut.
wa_ff67a-kwbtr = wa_ff67-kwbtr.
wa_ff67a-zuonr = wa_ff67-zuonr .
append wa_ff67a to it_ff67a.
endloop.
sort it_header by index.
delete adjacent duplicates from it_header comparing index.
loop at it_header into wa_header.
refresh it_bdcdata.
perform bdc_dynpro using 'SAPMF40K' '0101'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-AUSTG_DS'.
* wa_header-austg_ds.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'FEBMKA-BUKRS'
* record-BUKRS_001
wa_header-bukrs.
perform bdc_field using 'FEBMKA-HBKID'
* record-HBKID_002.
wa_header-hbkid.
perform bdc_field using 'FEBMKA-HKTID'
* record-HKTID_003.
wa_header-hktid.
perform bdc_field using 'FEBMKA-AZNUM'
* record-AZNUM_004.
wa_header-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
* record-AZDAT_005.
wa_header-azdat.
perform bdc_field using 'FEBMKA-SSALD'
* record-SSALD_006.
wa_header-ssald.
perform bdc_field using 'FEBMKA-ESALD'
* record-ESALD_007.
wa_header-esald.
perform bdc_field using 'FEBMKA-BUDTM'
* record-BUDTM_008.
wa_header-budtm.
perform bdc_field using 'FEBMKA-AUSTG_DS'
* record-AUSTG_DS_009.
wa_header-austg_ds.
perform bdc_dynpro using 'SAPMF40K' '8000'.
*
data : fnam(20) type c,
idx type c.
move 1 to idx.
BREAK-POINT.
loop at it_ff67a into wa_ff67a where index = wa_header-index.
concatenate 'febmka-vgman(' idx ')' into fnam.
perform bdc_field using fnam
wa_ff67a-vgman.
concatenate 'FEBEP-VALUT(' idx ')' into fnam.
perform bdc_field using fnam
wa_ff67a-valut.
******************************************
concatenate 'FEBMKA-KWBTR(' idx ')' into fnam.
perform bdc_field using fnam
wa_ff67a-kwbtr.
concatenate 'FEBMKK-ZUONR(' idx ')' into fnam.
perform bdc_field using fnam
wa_ff67a-zuonr.
*************************************************************
idx = idx + 1.
endloop.
perform bdc_dynpro using 'SAPMF40K' '8000'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-ZUONR(09)'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
call transaction 'FF67' using it_bdcdata
mode 'A'
update 'S'
messages into it_messtab.
perform fill_message.
refresh it_bdcdata[].
endloop.