‎2008 Jul 01 10:32 AM
Hi everybody!
Can I make a loop specifying in which line I want this loop start?
Thanks
Regards,
Rebeca
‎2008 Jul 01 10:35 AM
‎2008 Jul 01 10:35 AM
‎2008 Jul 01 10:35 AM
Hi Rebeca,
Yes offcourse you can do the loop at the index number.
Loop at it_final from 1 to 10.
write: it_final-text.
Endloop.
&*********Reward Point if helpful*********&
You are repeatedly breaking the rules of engagement
Edited by: Durairaj Athavan Raja on Jul 1, 2008 1:08 PM
‎2008 Jul 01 10:36 AM
Hi,
If you press the F1 key on your keyboard and read the on-line help for LOOP AT you will see you can add FROM into the command...
‎2008 Jul 01 11:46 AM
hi,
chk this link:
http://www.abapcode.sapbrainsonline.com/2008/03/loop-abap-keyword.html
Thanks,
keerthi.
‎2008 Jul 01 12:06 PM
Hi,
For that you have to use Conditional loop statement-
To terminate a single loop pass conditionally, use the CHECK <condition> statement in the statement block of the loop.
If the condition is not true, any remaining statements in the current statement block after the CHECK statement are ignored, and the next loop pass starts. <condition> can be any logical expression.
DO 4 TIMES.
CHECK SY-INDEX BETWEEN 2 and 3.
WRITE SY-INDEX.
ENDDO.
The output is:
2 3
The first and fourth loop passes are terminated without the WRITE statement being processed, because SY-INDEX is not between 2 and 3.
2.
DO 4 TIMES.
IF SY-INDEX = 2.
CONTINUE.
ENDIF.
WRITE SY-INDEX.
ENDDO.
The output is:
1 3 4
The second loop pass is terminated without the WRITE statement being processed.
Revert back if any confusion.
Regards,
Sujit
‎2008 Jul 01 12:12 PM
‎2008 Jul 01 12:14 PM
Hi
Please check it.
DATA : i_mara TYPE STANDARD TABLE OF mara,
wa_mara TYPE mara.
SELECT * FROM mara
UP TO 10 ROWS
INTO TABLE i_mara.
LOOP at i_mara INTO wa_mara FROM 8.
WRITE: / wa_mara-matnr.
ENDLOOP.