SAP标准系统中单据录入如果出错,当我们点击Message按钮的时候会显示如下图Message窗口
实现代码:
REPORT ZCN_TEST.
* types for messages
TYPES: BEGIN OF esp1_message_wa_type,
msgid LIKE sy-msgid,
msgty LIKE sy-msgty,
msgno LIKE sy-msgno,
msgv1 LIKE sy-msgv1,
msgv2 LIKE sy-msgv2,
msgv3 LIKE sy-msgv3,
msgv4 LIKE sy-msgv4,
lineno LIKE mesg-zeile,
END OF esp1_message_wa_type.
TYPES: esp1_message_tab_type TYPE esp1_message_wa_type OCCURS 20.
DATA:it_error_message TYPE esp1_message_tab_type WITH HEADER LINE.
DATA:v_lineno TYPE mesg-zeile.
CLEAR:v_lineno.
v_lineno = v_lineno + 1.
it_error_message-lineno = v_lineno.
it_error_message-msgid = '00'.
it_error_message-msgty = 'E'.
it_error_message-msgno = '000'.
it_error_message-msgv1 = 'Test Message 01'.
APPEND it_error_message.
v_lineno = v_lineno + 1.
it_error_message-lineno = v_lineno.
it_error_message-msgid = '00'.
it_error_message-msgty = 'W'.
it_error_message-msgno = '000'.
it_error_message-msgv1 = 'Test Message 02'.
APPEND it_error_message.
v_lineno = v_lineno + 1.
it_error_message-lineno = v_lineno.
it_error_message-msgid = '00'.
it_error_message-msgty = 'S'.
it_error_message-msgno = '000'.
it_error_message-msgv1 = 'Test Message 03'.
APPEND it_error_message.
v_lineno = v_lineno + 1.
it_error_message-lineno = v_lineno.
it_error_message-msgid = '00'.
it_error_message-msgty = 'A'.
it_error_message-msgno = '000'.
it_error_message-msgv1 = 'Test Message 04'.
APPEND it_error_message.
CALL FUNCTION 'C14Z_MESSAGES_SHOW_AS_POPUP'
TABLES
i_message_tab = it_error_message.
注意,Message type不能出现X,因为X代表dump :)
阅读(1703) | 评论(0) | 转发(0) |