0% found this document useful (0 votes)
15 views2 pages

Output: Do 5 Times. WRITE Sy-Index. " SY-INDEX (System Variable) - Current Loop Pass Enddo

The document discusses different loop control statements in ABAP including DO, WHILE, CONTINUE, CHECK, and EXIT. It provides examples of how each statement can be used to execute blocks of code repeatedly or terminate loops early. The DO statement executes code a specified number of times, WHILE loops until a condition is no longer true, CONTINUE skips to the next iteration, CHECK conditionally skips remaining code, and EXIT terminates the entire loop.

Uploaded by

nivas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Output: Do 5 Times. WRITE Sy-Index. " SY-INDEX (System Variable) - Current Loop Pass Enddo

The document discusses different loop control statements in ABAP including DO, WHILE, CONTINUE, CHECK, and EXIT. It provides examples of how each statement can be used to execute blocks of code repeatedly or terminate loops early. The DO statement executes code a specified number of times, WHILE loops until a condition is no longer true, CONTINUE skips to the next iteration, CHECK conditionally skips remaining code, and EXIT terminates the entire loop.

Uploaded by

nivas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

DO can be used to execute a certain lines of codes specific number of times.

DO 5 TIMES.
WRITE sy-index.
ENDDO.

" SY-INDEX (system variable) - Current loop pass

Output

WHILE ENDWHILE Conditional Loop


WHILE can be used to execute a certain lines of codes as long as the condition is true.
WHILE sy-index < 3.
WRITE sy-index.
ENDWHILE.

Output

CONTINUE Terminate a loop pass unconditionally.


After continue the control directly goes to the end statement of the current loop pass ignoring the
remaining statements in the current loop pass, starts the next loop pass.
DO 5 TIMES.
IF sy-index = 2.
CONTINUE.
ENDIF.
WRITE sy-index.
ENDDO.

Output

CHECK Terminate a loop pass conditionally.


If the condition is false, the control directly goes to the end statement of the current loop pass
ignoring the remaining statements in the current loop pass, starts the next loop pass.
DO 5 TIMES.
CHECK sy-index < 3.

WRITE sy-index.
ENDDO.

Output

EXIT Terminate an entire loop pass unconditionally.


After EXIT statement the control goes to the next statement after the end of loop statement.
DO 10 TIMES.
IF sy-index = 2.
EXIT.
ENDIF.
WRITE sy-index.
ENDDO.

Output

You might also like