‎2008 Jun 02 3:22 PM
Hi,
Is there an instruction to skip a loop step??
My code looks like that:
LOOP AT it_matnr.
IF it_matnr <> matnr.
CHECK 1 = 0.
ELSE.
* Do something....
ENDIF.
ENDLOOP.
The instruction CHECK 1 = 0 works but It isn't "elegant"... is there another option?
Don't say me that the SKIP step with CHECK 1 = 0 is useless, because that's only a sample code to explain the situation...
Edited by: Marshal Oliveras on Jun 2, 2008 4:23 PM
‎2008 Jun 02 3:26 PM
Hi,
You have a few options...
You could use LOOP AT WHERE...
Or use the CONTINUE command within your loop.
Check the F1 help for both of these to see if they are suitable.
Gareth.
‎2008 Jun 02 3:26 PM
Why do you not use:
LOOP AT it_matnr.
IF NOT it_matnr = matnr
do something
ENDIF.
ENDLOOP.
Kind regards,
Lieselot
‎2008 Jun 02 3:26 PM
Hi,
You have a few options...
You could use LOOP AT WHERE...
Or use the CONTINUE command within your loop.
Check the F1 help for both of these to see if they are suitable.
Gareth.
‎2008 Jun 02 3:26 PM
use continue.
LOOP AT it_matnr.
IF it_matnr matnr.
continue..
ELSE.
Do something....
ENDIF.
ENDLOOP.
Thanks,
Rajinikanth G.
‎2008 Jun 02 3:29 PM
Thank you.
CONTINUE is what I was looking for. The other solutions don't solve my problem because my code is much more complicated than the sample that I posted
‎2008 Jun 02 3:43 PM
To be honest, I tend to use CONTINUE instead of LOOP AT WHERE 99% of the time as I find it makes the code easier to read and helps when debugging...
Just my preference really.
Gareth.