Start of Content Area

Leaving a GET Event Block Using REJECT  Locate the document in its SAP Library structure

The REJECT statement was specially developed for leaving GET event blocks. Unlike CHECK and EXIT, REJECT always refers to the current GET event block. If CHECK and EXIT occur in a loop, they refer to the loop, and in a subroutine, they always refer to the subroutine. The REJECT statement, on the other hand, allows you to exit a GET event block directly from a loop or a called subroutine.

This graphic is explained in the accompanying text

The statement

REJECT [dbtab].

always terminates the processing of the current line of the node of the logical database. Without the optional dbtabspecification, the logical database automatically reads the next line of the same node, and the next GET event at the same hierarchy level is triggered. If you use the optional dbtab specification, the logical database reads the next line of the node dbtab. The node dbtab  must occur above the current node in the logical database hierarchy.

Example

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

REPORT EVENT_DEMO.

NODES: SPFLI, SFLIGHT, SBOOK.

GET SFLIGHT.
  SKIP.
  WRITE: / 'Carrid:', SFLIGHT-CARRID,
           'Connid:', SFLIGHT-CONNID,
           'Fldate:', SFLIGHT-FLDATE.

  ULINE.

GET SBOOK.
  PERFORM SUB.

FORM SUB.
  WRITE: / 'Bookid:', SBOOK-BOOKID.
  REJECT 'SFLIGHT'.
ENDFORM.

This program reads and displays only the first booking for each flight, since the logical database reads the next line of SFLIGHT after the REJECT statement.

This produces the following output list:

This graphic is explained in the accompanying text

 

 

End of Content Area