SAP EXIT LOOP ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for EXIT

EXIT - loop

Short Reference
• EXIT - loop ABAP Statement


ABAP Syntax EXIT.


What does it do? If the EXIT statement is specified within a loop, it exits the loop by ending the current loop pass. The program flow resumes after the closing statement in the loop.



Latest notes:Outside of a loop, the statement EXIT exits the
current processing block (see EXIT - Processing Block). EXIT, however, should only be used within loops.



Example ABAP Coding
Exits a loop using EXIT if the loop index
sy-index is greater than a number limit. DATA limit TYPE i VALUE 10.
DO.
IF sy-index > limit.
EXIT.
ENDIF.
cl_demo_output=>write( |{ sy-index } | ).
ENDDO.
cl_demo_output=>display( ).

Return to menu