Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Calling and leaving program units →  Exiting Program Units →  Exiting Processing Blocks 

STOP

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


STOP. 

Effect

The statement STOP is only to be used in executable programs and in the following event blocks:

These event blocks are exited using STOP and the runtime environment raises the event END-OF-SELECTION.


Note

The statement STOP cannot be used in methods and raises a non-handleable exception when processing dynpros called using CALL SCREEN, during a LOAD-OF-PROGRAM event, and in programs not called using SUBMIT.


Example

Ends the event block GET sbook of the logical database F1S, after max postings have been issued, and branches 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 += 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-Handleable Exceptions

  • Cause: The statement STOP was executed outside the process flow for an executable program.
    Runtime error: STOP_NO_REPORT
  • Cause: The statement STOP was executed during the process flow for a dynpro and therefore outside the permitted events.
    Runtime error: STOP_WITHIN_CALLED_DYNPRO