Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Increasing the index of the loop.


Hello Everyone,

I have a loop which I write like below:

Loop at itab into wa from index.

I use parallel cursor and use another loop.

     loop at itab1 into wa1.

          **** my code *****

    endloop.

endloop.

Now my requirement is that I start the first loop after some records if the second loop record exists.

Can I increase the value of index inside the second loop or how do I approach it?

Thanks.

Former Member
Former Member replied

Since I was looping the same table twice.

I added the index inside the second loop.

Below shows the result:

Loop at itab1 into wa1.

     read table itab1 into wa2 with key.

     index1=sy-tabix.

          loop at itab1 into wa3 from index1.

               index 1 = index1 + 1.

               *my code*

          endloop.

endloop.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question