[ABAP] Popup-Dialog zur Anzeige von BAPI-Meldungen

DATA(it_bapi_ret) = VALUE bapiret2_t( ( type       = 'S'
                                        id         = '01'
                                        number     = '319'
                                        message_v1 = 'Test'
                                      )
                                      ( type       = 'S'
                                        id         = '01'
                                        number     = '319'
                                        message_v1 = 'Test2'
                                      )
                                    ).

Variante 1 (cl_rmsl_message)

cl_rmsl_message=>display( it_bapi_ret ).

Variante 2 (cl_tex_message_handler)

cl_tex_message_handler=>display_bapiret2( it_bapi_ret ).

Variante 3 (C14ALD_BAPIRET2_SHOW)

* EHS: Anzeige einer BAPI-Fehlermeldungstabelle (BAPIRET2)
CALL FUNCTION 'C14ALD_BAPIRET2_SHOW'
  TABLES
    i_bapiret2_tab = it_bapi_ret.

Variante 4 (BSSP2_MESSAGE_POPUP)

DATA: lv_ef_continue TYPE boolean.

DATA(it_message) = VALUE bssp_t_message( ( msgid = 'SY' msgty = 'E' msgno = 100 msgv1 = 'Text1' msgv2 = '' msgv3 = '' msgv4 = '' row = 0 fieldname = '' )
                                         ( msgid = 'SY' msgty = 'W' msgno = 101 msgv1 = 'Text2' msgv2 = '' msgv3 = '' msgv4 = '' row = 0 fieldname = '' )
                                         ( msgid = 'SY' msgty = 'i' msgno = 102 msgv1 = 'Text3' msgv2 = '' msgv3 = '' msgv4 = '' row = 0 fieldname = '' ) ).

CALL FUNCTION 'BSSP2_MESSAGE_POPUP'
  EXPORTING
    it_message        = it_message
    if_save_necessary = abap_true
  IMPORTING
    ef_continue       = lv_ef_continue.

IF lv_ef_continue = abap_true.
* Sichern
ELSE.
* Abbrechen
ENDIF.

Variante 5 (C14Z_MESSAGES_SHOW_AS_POPUP)

DATA(it_messages) = VALUE esp1_message_tab_type( ( msgid = 'SY' msgno = '002' msgty = 'I' msgv1 = |Text1| lineno = 1 )
                                                 ( msgid = 'SY' msgno = '002' msgty = 'I' msgv1 = |Text2| lineno = 2 )
                                               ).

* EHS: eine oder mehrere Nachrichten in einem Popup anzeigen
CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
  TABLES
    i_message_tab = it_messages.

Variante 6 (cf_reca_message_list / RECA_GUI_MSGLIST_POPUP)

* Message-Collector Objekt
DATA(o_msg_list) = cf_reca_message_list=>create( ).

TRY.
* Division durch Null provozieren
    DATA(lv_div) = 1 / 0.
  CATCH cx_root INTO DATA(e_txt).
* Exception an den Collector übergeben
    o_msg_list->add_from_exception( e_txt ).
ENDTRY.

* Protokoll als Applikation bzw. Popup anzeigen
CALL FUNCTION 'RECA_GUI_MSGLIST_POPUP'
  EXPORTING
    io_msglist = o_msg_list.

Links