C14Z_MESSAGES_SHOW_AS_POPUP: Display SAP messages in a popup with message type

Function module C14Z_MESSAGES_SHOW_AS_POPUP can be used to display the popup messages with message types in ABAP.

Message class E4 (SE91) has been used for the demonstration.

message-popup-1

If you want to display just one message use the export parameters.

CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
  EXPORTING
    i_msgid  = 'E4'
    i_msgty  = 'E'
    i_msgno  = '001'
    i_msgv1  = 'ZTEST'
    i_lineno = 1.

Output

message-popup-2

If you want to display multiple messages make use of table parameters as shown below.

TYPE-POOLS: esp1.

DATA: lt_tab TYPE esp1_message_tab_type.
DATA: ls_tab TYPE esp1_message_wa_type.

ls_tab-msgid  = 'E4'.
ls_tab-msgno  = '000'.

ls_tab-msgty  = 'E'.
ls_tab-msgv1  = 'Error Message'.
ls_tab-lineno = 1.
APPEND ls_tab TO lt_tab.

ls_tab-msgty  = 'W'.
ls_tab-msgv1  = 'warning Message'.
ls_tab-lineno = 2.
APPEND ls_tab TO lt_tab.

ls_tab-msgty  = 'S'.
ls_tab-msgv1  = 'Success Message'.
ls_tab-lineno = 3.
APPEND ls_tab TO lt_tab.

CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
  TABLES
    i_message_tab = lt_tab.

Output

message-popup-3

This function module is suitable to display the messages of BAPI return parameter.