Entering content frame

Exiting Event Blocks Using EXIT Locate the document in its SAP Library structure

If you use the EXIT statement within an event block but not in a loop, the system stops processing the block immediately. The ABAP runtime environment triggers the next event according to the following diagram:

This graphic is explained in the accompanying text

Before and during selection screen processing, the next event in the prescribed sequence is always called. From the START-OF-SELECTION event onwards, the system starts the list processor directly when the EXITstatement occurs, and displays the list.

If the EXIT statement occurs inside a DO, WHILE, or LOOP loop, it is the loop that terminates, not the processing block.

Example

The following executable program is connected to the logical database F1S.

REPORT demo_program_exit_1.

NODES: spfli, sflight, sbook.

START-OF-SELECTION.
  WRITE 'Test Program for EXIT'.

GET sbook.
  WRITE: 'Bookid', sbook-bookid.
  EXIT.

END-OF-SELECTION.
  WRITE: / 'End of selection'.

This produces the following output:

Test Program for EXIT

Bookid 00010001

After the first line of SBOOK has been read, the list is displayed immediately.

Example

The following executable program is connected to the logical database F1S.

REPORT demo_program_exit_2.

NODES: spfli, sflight, sbook.

DATA flag(1) TYPE c.

AT SELECTION-SCREEN.
  IF carrid-low IS INITIAL.
    flag = 'X'.
    EXIT.
  ENDIF.

 

START-OF-SELECTION.
  IF flag = 'X'.
    WRITE / 'No input for CARRID'.
    EXIT.
  ENDIF.

GET spfli.

GET sflight.

GET sbook.

END-OF-SELECTION.
  WRITE / 'End of Selection'.

If the user does not enter a value for CARRID-LOW, the output appears as follows:

No selection made for CARRID

After the first EXIT statement, the next START-OF-SELECTION event is triggered. After the second EXITstatement, the output list is displayed.

 

 

 

 

Leaving content frame