使用场景:
通常在开发程序时,经常会通过弹出窗口显示错误消息。虽然可以通过编码实现这一功能,但使用标准功能可以更快速地实现。
call function 'MESSAGES_INITIALIZE'.
"MSG 1.
call function 'MESSAGE_STORE'
exporting
arbgb = 'SY'
msgty = 'E'
txtnr = '002'
msgv1 = '请输入物料代码.'
msgv2 = ''
msgv3 = ''
msgv4 = ''
zeile = 1.
"MSG 2.
call function 'MESSAGE_STORE'
exporting
arbgb = 'MI'
msgty = 'E'
txtnr = '504'
msgv1 = 'MARA '
msgv2 = 'MATNR'
msgv3 = ''
msgv4 = ''
zeile = 2.
call function 'MESSAGES_SHOW'
exporting
i_use_grid = abap_true
show_linno = abap_true
exceptions
inconsistent_range = 1
no_messages = 2
others = 3.