‎2007 Feb 22 4:50 PM
Is there any way i can make the loop statement skip some passes.
‎2007 Feb 22 4:53 PM
If it is conditional you can write where condition as below:
Loop at itab where matnr = p_matnr.
.
.
.
Endloop.
Or you can write If condition in the loop as:
Loop at itab.
If itab-matnr ne p_matnr.
continue.
endif.
.
.
Endloop.
Thanks
‎2007 Feb 22 4:53 PM
‎2007 Feb 22 4:53 PM
Hello,
You can do like this if my understanding is correct.
LOOP AT ITAB WHERE F! NE 'X'.
ENDLOOP.Vasanth
‎2007 Feb 22 4:53 PM
If it is conditional you can write where condition as below:
Loop at itab where matnr = p_matnr.
.
.
.
Endloop.
Or you can write If condition in the loop as:
Loop at itab.
If itab-matnr ne p_matnr.
continue.
endif.
.
.
Endloop.
Thanks
‎2007 Feb 22 5:16 PM
continue works and also if you want to skip the first few lines you can do it as loop at...from index 5.
‎2007 Feb 22 5:39 PM
Hi Deepthi,
Use CONTINUE in the LOOP...ENDLOOP statement to skip for that iteration.
Check this code.
DATA:
BEGIN OF ITAB OCCURS 0,
MATERIAL TYPE MARA-MATNR,
END OF ITAB.
START-OF-SELECTION.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
END-OF-SELECTION.
LOOP AT ITAB.
IF SY-TABIX >= '3' AND SY-TABIX <='7'.
<b>CONTINUE.</b>
ENDIF.
WRITE:/ SY-TABIX, ITAB.
ENDLOOP.
Thanks,
Vinay