*&---------------------------------------------------------------------*
*& Report ZSCH_011_CATCH_SYSTEM_EXEC
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zsch_011_catch_system_exec.


DATA: gd_result TYPE i,
      gd_number TYPE i.

*&---------------------------------------------------------------------*
*& Form div_0
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& -->  p1        text
*& <--  p2        text
*&---------------------------------------------------------------------*
FORM div_0 .
  gd_result = 1 DIV 0.
  gd_number = 1 DIV 0.

ENDFORM.

START-OF-SELECTION.
  CALL FUNCTION 'ICON_CREATE' 
    EXPORTING
      name                  = 'Schrödinger'
    IMPORTING
      result                = gd_result
    EXCEPTIONS
      icon_not_found        = 1
      outputfield_too_short = 2
      OTHERS                = 3.

  IF sy-subrc = 0.
    WRITE: / 'Yippieh, alles ok'.
  ELSEIF sy-subrc = 1.
    WRITE: / 'Leider Icon nicht gefunden'.
  ELSEIF sy-subrc = 2.
    WRITE: / 'Leider war ich bei der Definition der',
    'Ergebnisvariable nicht vorsichtig genug'.
  ELSE.
    WRITE: / 'Was da wohl passiert ist? ',
    'Auf alle Fälle eine Ausnahme'.


    CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
    OTHERS = 8."*1
      gd_result = 1 / gd_number.
    ENDCATCH.
    IF sy-subrc <> 0.
      WRITE: / 'Erwischt!'.
    ENDIF.
  ENDIF.

  CATCH SYSTEM-EXCEPTIONS OTHERS = 1.
    PERFORM div_0.
  ENDCATCH.
  IF sy-subrc = 1.
    WRITE: / 'Eine Ebene tiefer wird leider nicht erwischt'.
  ENDIF.