Skip to Content
0
Former Member
May 15, 2010 at 04:05 AM

Problem with Loop index.....

42 Views

Hi Experts,

i have a problem with Loop index, bcoz i am using Loop inside Loop, i know we cant use loop under loop, but as per my requirement i need to use loop under loop.

my code is like:

Loop AT itab1 into wa_itab1.

read table table it_header into wa_header with key field1 = wa_itab1-field1.

if sy-subrc = '0'.

Loop AT itab2 into wa_itab2 where field2 = wa_header-field2.

  • here processing logic........

delete itab2 from wa_itab2. ( or) del the specific record from ITAB1.

Modify itab1 from wa_itab1 TRANSPORTING FIELD3.

endloop.

endif.

endllop.

Here my requirement is from ITAB1 allways i need to loop first, since i am modifying or delete the records from ITAB1.

from ITAB1 in second loop also i neeed to pic first record, But here prob is 2nd time SY-TABIX becoming 2,

so How to make SY-TABIX should be 1.

i have checked like Loop AT itab1 into wa_itab1 FROM '1'. ( also not working).

can anyone give me the logic.....

Regards,

Sudha.