Skip to Content
0
Former Member
Mar 24, 2009 at 05:07 AM

linking 2 loops

65 Views

Hi Experts..............

i have used the first loop to delete the document with the condition as '101,

and in next loop it has the details such as decription quantity etc etc.....

and my second loop (it_lips to wa_lips) only has the final table to be populated in

my ALV....

My requirement is that i want to link the first loop and the next loop in such a way

that watever document number is there, in my first loop that alone has to go to next loop to

fill the field rest should not come,

I have added this peice of code in loop it_lips further to check and update which satisfies

the loop it_vbfa i dont know how to do....

read table it_vbfa into wa_vbfa with key vbeln = wa_lips-vbeln.

if sy-subrc = 0.

wa_final-vbeln = wa_lips-vbeln.

Endif.

I dont know how to link and make the updation....

Pls do help me out

Thanx in advance

Rachel

Code as follows

=======================

*****For deleting movement typ 101

loop at it_vbfa into wa_vbfa where bwart = '101'.

delete it_vbfa where vbelv = wa_vbfa-vbelv .

Endloop.

*******Final looping

loop at it_lips into wa_lips .

read table it_vbfa into wa_vbfa with key vbeln = wa_lips-vbeln.

if sy-subrc = 0.

wa_final-vbeln = wa_lips-vbeln.

Endif.

read table it_ekpo into wa_ekpo with key ebeln = wa_lips-vgbel.

If sy-subrc = 0.

wa_final-recp = wa_ekpo-werks.

wa_final-rec = wa_ekpo-lgort.

read table it_likp into wa_likp with key vbeln = wa_lips-vbeln.

If sy-subrc = 0.

wa_final-stno = wa_likp-vbeln.

Endif.

Endif.

Append wa_final to it_final.

Endloop.

clear: wa_vbfa, wa_final.