‎2005 Oct 31 5:11 AM
Hi gurus,
I have a issue with nested looping. Based on the quantity in the order item I want to print the number of labels at item level.
i.e Order Item qty
111 10 2 ( I need 2 labels )
111 20 3 ( I need 3 labels )
112 10 5 ( I need 5 labels )
So under the order items loop, I created another loop and and added a program line and tried to manage the 2nd loop by a count. But I failed, I just couldn't get the loop working properly.
How can I control the second loop just by a count and exit it once it reaches a particular value.
Thanks and regards
Dhanushka.
‎2005 Oct 31 6:15 AM
In the second loop, put the condition on item and order number.
I mean in the whrere clause of the second loop, use the condition item = 1stloop-item
‎2005 Oct 31 6:15 AM
In the second loop, put the condition on item and order number.
I mean in the whrere clause of the second loop, use the condition item = 1stloop-item
‎2005 Nov 01 2:31 AM
Hi,
You can use counter also
loop at itab.
counter = 10.
loop at itab where sy-tabix <= counter.
endloop.
endloop.
Hope this will work for you
‎2005 Nov 01 11:15 PM
Hi,
There is no itab for second loop. I just want to have a DO WHILE till it reaches a Value. Basically once it reaches the value it should exit from the second loop in the smartform and go to the next item in the first loop. Can i do this without having another itab for the second loop.
Thanks & Regards
Dhanushka.
‎2005 Nov 01 11:27 PM
Hi
I hope this example is helfull for you:
DATA: BEGIN OF ITAB,
NUMBER TYPE ...
ITEM TYPE ...
QTY TYPE ...
END OF ITAB.
DATA TIMES TYPE I.
LOOP AT ITAB.
MOVE ITAB-QTY TO TIMES.
DO TIMES TIMES.
......
ENDDO.
ENDLOOP.
You can use a WHILE cycle:
DATA COUNTER TYPE I.
LOOP AT ITAB.
MOVE ITAB-QTY TO TIMES.
COUNTER = 0.
WHILE COUNTER > TIMES.
......
COUNTER = COUNTER + 1.
ENDWHILE.
ENDLOOP.
Max
Message was edited by: max bianchi
‎2005 Nov 01 11:41 PM
Hi,
loop at item table.
at new posnr.
do qty times.
call print lable program
enddo.
endat.
endloop.
Hope this help you.
Thanks,
Nethaji.