一、创建
二、应用
REPORT YZLL_MSG_TEST MESSAGE-ID YZLL_MSG_DM01.
CLASS DEMO DEFINITION.
PUBLIC SECTION.
CLASS-METHODS ABORT.
CLASS-METHODS INFO.
CLASS-METHODS ERROR.
CLASS-METHODS WARN.
CLASS-METHODS SUCCESS.
CLASS-METHODS EXIT.
CLASS-METHODS SHOW.
CLASS-METHODS USAGE.
ENDCLASS.
CLASS DEMO IMPLEMENTATION.
METHOD ABORT.
MESSAGE A000.
ENDMETHOD.
METHOD INFO.
MESSAGE I001.
ENDMETHOD.
METHOD ERROR.
MESSAGE E002.
ENDMETHOD.
METHOD WARN.
MESSAGE W003.
ENDMETHOD.
METHOD SUCCESS.
MESSAGE S004.
ENDMETHOD.
METHOD EXIT.
MESSAGE X005.
ENDMETHOD.
METHOD SHOW.
DATA:
TEXT0 TYPE STRING,
TEXT1 TYPE STRING,
TEXT2 TYPE STRING,
TEXT3 TYPE STRING,
TEXT4 TYPE STRING.
INFO( ). "弹窗消息
MESSAGE I006 INTO TEXT0.
MESSAGE I007 WITH 'A' 'B' 'C' 'D' INTO TEXT1. "WITH在前可以
MESSAGE I008 INTO TEXT2.
MESSAGE I009 INTO TEXT3 WITH 'A' 'B' 'C' 'D' . "WITH在后也可以
MESSAGE I010 WITH 'A' INTO TEXT4.
WRITE:/ '不带占位符的消息:', TEXT0.
WRITE:/ '顺序占位符的消息:', TEXT1.
WRITE:/ '输出&符号的消息:', TEXT2.
WRITE:/ '排序占位符的消息:', TEXT3.
WRITE:/ '复用占位符的消息:', TEXT4.
SUCCESS( ). "状态栏消息
ENDMETHOD.
METHOD USAGE.
"方式一:MESSAGE - msg
MESSAGE I006. "需在报表程序名后面定义MESSAGE-ID yzll_msg_dm01
MESSAGE I006(YZLL_MSG_DM01).
DATA:
MID TYPE SY-MSGID VALUE 'YZLL_MSG_DM01',
MTYPE TYPE SY-MSGTY VALUE 'I',
NUM TYPE SY-MSGNO VALUE '006'.
MESSAGE ID MID TYPE MTYPE NUMBER NUM.
"方式二:MESSAGE - text
DATA OREF TYPE REF TO CX_SY_ARITHMETIC_ERROR.
DATA LV_VAL TYPE I.
TRY.
LV_VAL = 1 / 0.
CATCH CX_SY_ARITHMETIC_ERROR INTO OREF.
MESSAGE OREF->GET_TEXT( ) TYPE 'I'.
ENDTRY.
"方式三:MESSAGE - INTO
"参考 demo=>show( )
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
"DEMO=>ABORT( ).
"DEMO=>EXIT( ).
"DEMO=>ERROR( ).
"DEMO=>WARN( ).
DEMO=>SHOW( ).
"DEMO=>USAGE( ).
改变消息默认显示方式
MESSAGE W002(00) DISPLAY LIKE 'I'.
此语句可以使消息以I类型的样式(弹窗确认)展示,但是按照‘W’类型消息执行(警告继续)。
今天的文章sap消息号处理方法_sap 模块分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/72329.html