SAP ABAP - Exit Statement


Advertisements

EXIT statement is used to terminate an entire loop unconditionally and immediately. As soon as the EXIT statement is executed, the loop is terminated and the statements following the loop are processed.

The syntax for exit statement is −

EXIT.

Note − If the EXIT statement is used in a nested loop, only the current loop is executed after the EXIT statement is processed.

Block Diagram

Exit Statement

Example

Report YH_SEP_15.  
DO 5 TIMES.  
IF SY-INDEX = 3.  
EXIT.  
ENDIF.  
Write / SY-INDEX.  
ENDDO.

The above code produces the following output −

1
2
sap_abap_loop_control.htm

Useful Video Courses


Video

SAPUI5 Online Training

25 Lectures 6 hours

Sanjo Thomas

Video

SAP Webi Online Training

Most Popular

26 Lectures 2 hours

Neha Gupta

Video

SAP Basis Online Training

30 Lectures 2.5 hours

Sumit Agarwal

Video

SAP C4C Online Training

30 Lectures 4 hours

Sumit Agarwal

Video

SAP MM Online Training

14 Lectures 1.5 hours

Neha Malik

Video

SAP WM Online Training

13 Lectures 1.5 hours

Neha Malik

Advertisements