[ABAP] Fehlermeldungen über die Standard-Exceptionklasse CX_T100_MSG ausgeben

* Auslösen der Exeption CX_T100_MSG
CLASS zxyz DEFINITION FINAL.

  PUBLIC SECTION.

    METHODS: constructor
      IMPORTING
        !iv_text TYPE string " Übergabestring für Test
      RAISING
        cx_t100_msg.         " Fehler im Konstruktor löst evtl. CX_T100_MSG aus

ENDCLASS.

CLASS zxyz IMPLEMENTATION.
  METHOD constructor.

    IF NOT iv_text IS INITIAL.

      ...

    ELSE.
* Wenn iv_text leer -> CX_T100_MSG auslösen
      RAISE EXCEPTION TYPE cx_t100_msg
        EXPORTING
          t100_msgid = '00'
          t100_msgno = '398'
          t100_msgv1 = 'Text war leer.' " 1. String
          t100_msgv2 = ''               " 2. String
          t100_msgv3 = ''               " 3. String
          t100_msgv4 = ''.              " 4. String
    ENDIF.

  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
* Exception CX_T100_MSG abfangen
  TRY.
* zum Auslösen der Exception den Übergabeparameter leer lassen
      DATA(o_test) = NEW zxyz( iv_text = '' ).
* Exception abfangen
    CATCH cx_root INTO DATA(e_txt).
* Klassenname
      WRITE: / cl_abap_classdescr=>get_class_name( p_object = e_txt ).
* Messagetext
      WRITE: / e_txt->get_text( ).
  ENDTRY.