2012 Aug 20 11:39 AM
Hi all,
I have query related to BDC Code. I am uplaoding some Document nos. through my report to F-28 Transaction, When i am calling Loop documents related to one Billing document no is being populated to F-28 but when second time loop is called documents related to another Billing Document no is getting overwritten previous Documents on the same Field location. Please share some relevant code so that Documents always lie on the next location everytime loop is called.
| LOOP AT IST_BSID INTO WA_BSID WHERE REBZG = WA_FINAL-VBELN. |
IF SY-TABIX = '1'.
| READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX. |
| PERFORM BDC_FIELD | USING 'RF05A-SEL01(01)' WA_BSID1-BELNR.". | ||
| ENDIF. |
IF SY-TABIX = '2'.
| READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX. |
| PERFORM BDC_FIELD | USING 'RF05A-SEL01(02)' WA_BSID1-BELNR.". | ||
| ENDIF. |
IF SY-TABIX = '3'.
| READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX. |
| PERFORM BDC_FIELD | USING 'RF05A-SEL01(03)' WA_BSID1-BELNR.". | ||
| ENDIF. |
IF SY-TABIX = '4'.
| READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX. |
| PERFORM BDC_FIELD | USING 'RF05A-SEL01(04)' WA_BSID1-BELNR.". | ||
| ENDIF. |
ENDLOOP.
2012 Aug 20 12:07 PM
Hiii,
As i understand same case i had also faced you have to set cursor before updating second document number than 3rd than 4th .... see below code and try this -
IF SY-TABIX = '1'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 1st loop
'RF05A-SEL01(01)'. " check this cursor value as per your screen code this is just example
Your Logic :
READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX.
PERFORM BDC_FIELD USING 'RF05A-SEL01(01)' WA_BSID1-BELNR.".
ELSEIF SY-TABIX = '2'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 2nd loop
'RF05A-SEL01(02)'.
Your Logic :
ELSEIF SY-TABIX = '3'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 3rd loop
'RF05A-SEL01(03)'.
Your Logic :
ELSEIF SY-TABIX = '4'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 4th loop
'RF05A-SEL01(04)'.
Your Logic :
Hiii,
As i understand same case i had also faced you have to set cursor before updating second document number than 3rd than 4th .... see below code and try this -
IF SY-TABIX = '1'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 1st loop
'RF05A-SEL01(01)'. " check this cursor value as per your screen code this is just example
Your Logic :
READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX.
PERFORM BDC_FIELD USING 'RF05A-SEL01(01)' WA_BSID1-BELNR.".
ELSEIF SY-TABIX = '2'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 2nd loop
'RF05A-SEL01(02)'.
Your Logic :
ELSEIF SY-TABIX = '3'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 3rd loop
'RF05A-SEL01(03)'.
Your Logic :
ELSEIF SY-TABIX = '4'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 4th loop
'RF05A-SEL01(04)'.
Your Logic :
2012 Aug 20 12:07 PM
Hiii,
As i understand same case i had also faced you have to set cursor before updating second document number than 3rd than 4th .... see below code and try this -
IF SY-TABIX = '1'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 1st loop
'RF05A-SEL01(01)'. " check this cursor value as per your screen code this is just example
Your Logic :
READ TABLE IST_BSID INTO WA_BSID INDEX SY-TABIX.
PERFORM BDC_FIELD USING 'RF05A-SEL01(01)' WA_BSID1-BELNR.".
ELSEIF SY-TABIX = '2'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 2nd loop
'RF05A-SEL01(02)'.
Your Logic :
ELSEIF SY-TABIX = '3'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 3rd loop
'RF05A-SEL01(03)'.
Your Logic :
ELSEIF SY-TABIX = '4'.
PERFORM bdc_field USING 'BDC_CURSOR' " this is for 4th loop
'RF05A-SEL01(04)'.
Your Logic :
2012 Aug 20 1:31 PM
Hi Ashish, gud to see your reply.
Actually my table is having 4 Document nos & each Document no is having 5-6 Ref Document nos...So for 4 Documents i have to upload arround 20 Ref Documents one after another. i hv already set the cursor for each Document no but concern is that when loop is called for First Document no it uploads 5 ref document related to its no , Second time when loop is called it overwrite previous documents so this way only 5-6 Ref Documents is being uploaded of last Document no.
There is any possiblity so that when second loop is called, it will set cursor position after 5 or 6th position.and Ref Document will upload from the nxt position.
Regards
Deepa
2012 Aug 20 2:11 PM
Hi Deepa,
DATA : INDEX type numc(2),
variable type char(25).
LOOP AT IT_BSID INTO WA_BSID WHERE REBZG = WA_FINAL-VBELN.
index = index + 1.
CONCATENATE 'RF05A-SEL01(' index ')' INTO variable.
| PERFORM BDC_FIELD USING VARIABLE WA_BSID1-BELNR.". |
ENDLOOP.
You can try like this. It will solve your problem.
Regards,
Bharathkumar.MG
2012 Aug 20 2:37 PM
Hiii,
Yes you can set but in your table how many rows are displaying ??? or can you give me some more detail means - for 5th or 6th row you want scroll down or some other processing ??? ...... in my case 4 rows were displayed so for 5th one i have applied logic as per that but you can - Try below code in second loop pass - apply 2nd loop or required condition .
PERFORM bdc_field USING 'BDC_CURSOR'
RF05A-SEL01(05)
PERFORM bdc_field USING 'BDC_OKCODE'
'=p+'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
2012 Aug 20 4:44 PM
Hi Bharath,
My issue has been resolved. Code given by u has helped me.
Regards
Deepa
2012 Aug 20 4:52 PM
2012 Aug 20 12:15 PM
Hi Deepa,
There may be two possibilities for getting data overwritten,
1. Just check the BDC coding once the first loop call transaction is done, clear the BDCDATA table value. Then proceed for second loop.
2. Then check the recording is done with save option also, so that second loop data will be processed only if the first loop data is saved, else the second loop data will be get overwritten with first loop data itself.
Try with these possibilities and let me know..
Thanks,
Bharathkumar.MG
2012 Aug 20 12:25 PM
Please send your entire code if possible.
So that I can check the problem.
Thank you.
Regards,
Ravivarma
2012 Aug 20 12:42 PM
hi deepa,
please find the sample code below.
loop at itable into wa.
refresh bdcdata.
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-MATNR.
"'10000a02'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(12)'.
perform bdc_field using 'BDC_OKCODE'
'=SCHL'.
perform bdc_field using 'MSICHTAUSW-KZSEL(12)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '0080'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-LGORT'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'RMMG1-WERKS' WA-WERKS.
"'1001'.
perform bdc_dynpro using 'SAPLMGMM' '4000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARC-PRCTR'.
perform bdc_field using 'MARC-PRCTR' WA-PRCTR.
"'al-AC-NTB'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
thanks,
MARIMUTHU.K
2012 Aug 20 2:18 PM
As far as my understanding of ur requirement,
you take all doc.nos into one internal table and all reference docs. into another internal table.
Add additional field in both internal tables of type C length 2.
For first doc no. give the value as D1, for 2nd D2.......
In ref doc. internal table give R1 for all ref docs that are corresponding to D1.
R2 for all ref docs that are corresponding to D2 so on...
Then loop both internal tables like below.
data : count type i value 1.
loop at it_doc into wa_doc.
if wa_doc-f1+1(1) eq count.
your logic.............
loop at it_ref_doc into wa_ref_doc.
if wa_ref_doc-f1+1(1) eq count.
your logic................
endif.
endloop.
endif.
count = count + 1.
endloop.
With regards,
Ravivarma.
2012 Aug 20 3:58 PM
Hi Deep,
The first thing that I can see is you are trying to upload five dpcument nos in five rows of same screen .
Do one thing go to transaction you will find some thing in EDIT menu where you can fetch the last record on the first position of the screen hope you are getting me , in this way you do not need to write 01 , 02 , 03 and so on ,,,and it will update all the fields and befor goind=g to nest loop save it ,,, record it again hope it will help you,
Please let me know if you still face the isuue..
Thanks
Rahul
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |