Hi Friends,
I am working on creating Credit memos and return orders through BDC. For the item level, I am incrementing the index in order to enter the MATNR, POSNR, KWMENG etc. I have seven lines open in my screen. So when I have an order greater than or equal to seven lines, the program is showing an error that that line does not exist in the screen. Please, let me know what is the solution for this.
Thanks,
Raj
Hi, as Srinivas post before that should work, I just edited some lines, I guess was just mistyped.
idx = 01.
LOOP AT itabi WHERE ihrez = itabh-ihrez.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.
CONCATENATE 'VBAP-ABGRU(' idx ')' INTO fnam.
PERFORM bdc_field USING 'BDC_CURSOR' fnam.
CONCATENATE 'RV45A-MABNR(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam itabi-mabnr.
CONCATENATE 'VBAP-ZMENG(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam itabi-zmeng.
CONCATENATE 'VBAP-POSNR(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam itabi-posnr.
CONCATENATE 'VBAP-ABGRU(' idx ')' INTO fnam.
PERFORM bdc_field USING fnam 'Z2'.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PKO1'.
CONCATENATE 'VBAP-POSNR(' idx ')' INTO fnam.
PERFORM bdc_field USING 'BDC_CURSOR' fnam.
PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KSCHL(01)'.
PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
PERFORM bdc_field USING 'BDC_OKCODE' '=V69A_KOAN'.
PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KSCHL(01)'.
PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'BDC_CURSOR' 'KOMV-KWERT(07)'.
PERFORM bdc_field USING 'KOMV-KSCHL(02)' 'ZPR0'.
PERFORM bdc_field USING 'KOMV-KBETR(02)' itabi-kbetr1.
PERFORM bdc_field USING 'KOMV-KSCHL(03)' 'ZPRS'.
PERFORM bdc_field USING 'KOMV-KBETR(03)' itabi-kbetr2.
PERFORM bdc_field USING 'KOMV-KSCHL(04)' 'ZR1'.
PERFORM bdc_field USING 'KOMV-KWERT(04)' itabi-kwert1.
PERFORM bdc_field USING 'KOMV-KSCHL(05)' 'ZLWR'.
PERFORM bdc_field USING 'KOMV-KWERT(05)' itabi-kwert2.
PERFORM bdc_field USING 'KOMV-KSCHL(06)' 'ZLDL'.
PERFORM bdc_field USING 'KOMV-KWERT(06)' itabi-kwert3.
PERFORM bdc_field USING 'KOMV-KSCHL(07)' 'ZLFB'.
PERFORM bdc_field USING 'KOMV-KWERT(07)' itabi-kwert4.
perform bdc_field using 'KOMV-KSCHL(08)'
'ZLBD'.
perform bdc_field using 'KOMV-KWERT(08)'
'0.00'.
PERFORM bdc_dynpro USING 'SAPMV45A' '5003'.
PERFORM bdc_field USING 'BDC_OKCODE' '=T\13'.
PERFORM bdc_dynpro USING 'SAPMV45A' '4003'.
PERFORM bdc_field USING 'BDC_OKCODE' '/EBACK'.
PERFORM bdc_field USING 'BDC_CURSOR' 'VBAP-ZZRFAR'.
PERFORM bdc_field USING 'VBAP-ZZRWAR' itabi-wcd.
PERFORM bdc_field USING 'VBAP-ZZRFAR' itabi-fcd.
<b>IF idx >= 2.</b>
*-- from third line onwards start doing '+'
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.
<b>idx = 1.</b>
ELSE.
*-- this will increment it to 2 and then the IF will takeover
idx = idx + 1.
ENDIF.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE''=SICH'.
Another way to do this is, usually the way I go, is to just execute the next two lines for every incoming line:
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
PERFORM bdc_field USING 'BDC_OKCODE' '=POAN'.
Hope it Helps.
Regards,
Gilberto Li
I believe that when you get to that point, you will need to fire a page down in the OKCODE. I think maybe P+ may work. I have seen many posts that cover this. I usually try to stay away from doing this kind of thing with table controls in BDC, are you sure there is not a BAPI or function module that will work for you?
BDC: How to enter data in Table control (With wizard) using scrolling?
Regard,
Rich Heilman
Hi Raj,
Please try to code BDC_OKCODE = '/00' after looping 7 times. It should open next 7th line items.
Hope this will help.
Regards,
Ferry Lianto
Add a comment