*---消息的种类:I(信息窗口),W(警告),E(错误),S(成功),A(停止),X(未知)
1.message'没有数据了!'type 'S' ."状态栏上输出绿色消息提示
2.message'没有数据了!'type 'S' display like 'E'."与上面相同,但颜色是红的,比较显眼.
3.message'没有数据了!'type 'I' ."给出一个消息框
3.message'没有数据了!'type 'E' ."错误提示,无法进行下面的工作
4.message i888(sabapdocu) with '你没有选择任何一条记录!'."这也是一种消息框方式.
5.message'没有数据了!'type 'W' ."警告
*---调用系统函数失败后可以用
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*---E类型错误的一个特殊应用
在选择屏幕上,如果用message 'XXX' type 'E'(或message 'XXX' type 'E') ,则程序会停在选择屏幕,
如果用message 'XXX' type 'S',则程序会继续往下执行start-of-selection等
*---获得消息描述
loop at return_tab.
call function 'MESSAGE_TEXT_BUILD'
exporting
msgid = return_tab-id
msgnr = return_tab-number
importing
message_text_output = return_tab-text.
modify return_tab.
endloop.
或
message id wa_bdcmsg-msgid
type wa_bdcmsg-msgtyp
number wa_bdcmsg-msgnr
with wa_bdcmsg-msgv1 wa_bdcmsg-msgv2 wa_bdcmsg-msgv3 wa_bdcmsg-msgv4 into l_message.
*-- 消息宏 --
include mm_messages_mac."宏定义引入
mmpur_message 'S'
'OO'
'000'
'aa'
'bb'
'cc'
'dd'.
评论