EXIT statement is used for terminating the loops or exit from the current processing blocks.
Here are some important notes about ABAP EXIT statement
- If EXIT statement is triggered outside the loop, it will terminate the current processing block.
- If EXIT statement is triggered within a loop, it terminated the loop and program execution continues from the end of loop block.
- We cannot exit LOAD-OF-PROGRAM event using EXIT statement.
DATA count TYPE i VALUE 100.
IF sy-index > count.
WRITE / sy-index.
In this program, the loop will terminate when the system field sy-index value greater than the count variable field (here it is 100).
Also Read : View Other ABAP Keywords & Syntax -> ABAP Transaction codes