ABAP – Return to Selection screen after error in START-OF-SELECTION

SAPSometimes you need to do some data processing and in case of error you’d like to return user back to selection screen and display the error message.
This can be done eg. by the following:

DATA: lv_ok type abap_bool.
* Let's simulate error situation
  lv_ok = abap_false.

START-OF-SELECTION.
  IF lv_ok = abap_true.
*   ...
  ELSE.
    MESSAGE 'No data selected'(001) TYPE 'S' DISPLAY LIKE 'E'.
    LEAVE LIST-PROCESSING.
  ENDIF.

Leave a Reply