SAP® Documentation

Single view

ABAPEXIT_PROCESSING_BLOCKS - EXIT PROCESSING BLOCKS

Fill RESBD Structure from EBP Component Structure   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

EXIT - processing_block

Short Reference



Syntax

EXIT.

Effect

If the statement EXIT is located outside a loop, the statement immediately terminates the current processing block.

After the processing block is exited, the runtime environment responds in the same way as when the processing block is exited in a regular way (with the exception of the event block LOAD-OF-PROGRAM and the reporting event blocksSTART-OF-SELECTION and GET) . In particular, the output parameters of procedures are passed on to the bound actual parameters.

  • The event block LOAD-OF-PROGRAM cannot be exited using EXIT.
  • After the reporting event blocks START-OF-SELECTION and GET have been exited using EXIT, the runtime environment does not trigger any more reporting events; instead, it calls the list processor directly to display the basic list.

Only use RETURN to exit procedures

Example

The method main contains two EXIT statements. Whereas the first statement exits the LOOP loop, the second statement exits the entire method. The RETURN statement should be used instead of the EXIT statement.

TYPES:
  BEGIN OF line,
    col1 TYPE string,
    col2 TYPE string,
  END OF line,
  itab TYPE STANDARD TABLE OF line WITH EMPTY KEY.

CLASS demo DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main IMPORTING char TYPE string
                                 itab TYPE itab.
ENDCLASS.

CLASS demo IMPLEMENTATION.
  METHOD main.
    LOOP AT itab INTO DATA(wa).
      FIND char IN wa-col1 RESPECTING CASE.
      IF sy-subrc = 0.
        EXIT.
      ENDIF.
    ENDLOOP.
    FIND to_upper( char ) IN wa-col2 RESPECTING CASE.
    IF sy-subrc <> 0.
      EXIT.                   "works as RETURN here!
    ENDIF.
    ...
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  DATA(itab) = VALUE itab(
    ( col1 = `aaaa` col2 = `AAAA` )
    ( col1 = `bbbb` col2 = `XXXX` )
    ( col1 = `cccc` col2 = `CCCC` ) ).
  demo=>main( char = `b`
              itab = itab ).






ROGBILLS - Synchronize billing plans   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 4159 Date: 20200127 Time: 224101     sap01-206 ( 25 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.