[ABAP] Message-Klasse über Interface if_t100_dyn_msg definieren

* https://blogs.sap.com/2015/11/12/abap-news-for-release-750-converting-messages-into-exceptions/
* Demo: DEMO_MESSAGE_TEXTS

CLASS lcl_msg_class DEFINITION.
  PUBLIC SECTION.
    INTERFACES if_t100_dyn_msg.

    ALIASES: t100_key FOR if_t100_message~t100key.
    ALIASES: msgty    FOR if_t100_dyn_msg~msgty.
    METHODS
      constructor
        IMPORTING
          msgid TYPE symsgid
          msgno TYPE symsgno
          msgty TYPE symsgty.
ENDCLASS.

CLASS lcl_msg_class IMPLEMENTATION.
  METHOD constructor.
    me->t100_key-msgid = msgid.
    me->t100_key-msgno = msgno.
    me->msgty          = msgty.
  ENDMETHOD.

  METHOD if_message~get_text.
    result = cl_message_helper=>get_text_for_message( me ).
  ENDMETHOD.

  METHOD if_message~get_longtext.
    result = cl_message_helper=>get_longtext_for_message( me ).
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  MESSAGE NEW lcl_msg_class( msgid = 'SABAPDEMOS'
                             msgno = '001'
                             msgty = 'I' ).