Search code examples
abap

Skip processing of a logical database?


In case a user sets a parameter to skip the processing of the logical database it should be skipped. But unfortunately, I can't find a way, since whatever I try the reports ends completly. Example of what I tried:

REPORT zxxxx.

TABLES: pernr.
NODES peras.

PARAMETERS: p_skip AS CHECKBOX.

START-OF-SELECTION.
  IF p_skip = abap_true.
    RETURN. " Also tried EXIT.
  ENDIF.

GET peras.
  WRITE 'ABC'.

end-of-selection.
  WRITE 'test'.

My expectation was that the Report jumps directly to "END-OF-SELECTION", but it doesn't.

What statement do I need to use here? Or is there a workaround? (Otherwise I have to write the logic for the LDB myself)


Solution

  • The STOP statement has to be used, if you want to jump directly to END-OF-SELECTION.

      IF p_skip = abap_true.
        STOP.
      ENDIF.
    

    https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapstop.htm

    It might be worth mentioning that logical databases are already obsolete.