ABAP Keyword Documentation → ABAP - Reference → Calling and leaving program units → Exiting Program Units → Exiting Processing Blocks
STOP
Other versions: 7.31 | 7.40 | 7.54
Syntax
STOP.
Effect
The STOP
statement is only to be used in executable programs and in the following event blocks:
-
AT SELECTION-SCREEN
(without additions) -
START-OF-SELECTION
-
GET
These event blocks are exited using STOP
and the runtime environment triggers the event END-OF-SELECTION
.
Note
The STOP
statement cannot be used in methods and raises a non-handleable exception when processing
dynpros called with
CALL SCREEN
, during a
LOAD-OF-PROGRAM event, and in programs not called with SUBMIT
.
Example
Ending the event block GET sbook
of the
logical database
F1S, after max
postings have been issued, and branching to END-OF-SELECTION
.
NODES: sflight,
sbook.
DATA: bookings TYPE i,
max TYPE i VALUE 100.
GET sflight.
cl_demo_output=>next_section( |{ sflight-carrid } | &&
|{ sflight-connid } | &&
|{ sflight-fldate }| ).
GET sbook.
bookings = bookings + 1.
cl_demo_output=>write( |{ sbook-bookid } | &&
|{ sbook-customid }| ).
IF bookings = max.
STOP.
ENDIF.
END-OF-SELECTION.
cl_demo_output=>line( ).
cl_demo_output=>display( |First { bookings } bookings| ).
Exceptions
Non-Catchable Exceptions
-
Cause: The
STOP
statement was executed outside the process for an executable program.
Runtime Error:STOP_NO_REPORT
-
Cause: The
STOP
statement was executed during the process for a screen and therefore outside the permitted events.
Runtime Error:STOP_WITHIN_CALLED_DYNPRO