Web Dynpro for ABAP(13):Messages

3.18 Messages

WDA运行过程中显示提示信息。

示例:WDR_TEST_MSG_AREA;

使用接口类:IF_WD_MESSAGE_MANAGER;

类中方法:

CLEAR_MESSAGES:Deletes all messages

IS_EMPTY:Queries whether messages are available

REPORT_ATTRIBUTE_ERROR_MESSAGE:Reports a Web Dynpro exception for a context attribute

REPORT_ATTRIBUTE_EXCEPTION:Reports a Web Dynpro exception for a context attribute

REPORT_ATTRIBUTE_T100_MESSAGE:Reports a Web Dynpro exception for a context attribute

REPORT_ERROR_MESSAGE:Reports a Web Dynpro message with optional parameters

REPORT_EXCEPTION:Reports a Web Dynpro exception (may be returned)

REPORT_FATAL_ERROR_MESSAGE:Reports a fatal Web Dynpro message with optional parameters

REPORT_FATAL_EXCEPTION:Reports a fatal Web Dynpro exception

REPORT_SUCCESS:Reports a success message

REPORT_T100_MESSAGE:Reports a message using a T100 entry

REPORT_WARNING:Reports a warning

配置Message Area,使用接口类:IF_WD_MESSAGE_AREA方法。

示例:

l_api_mycomp type ref toif_wd_window_controller,

l_wd_message_area type ref toif_wd_message_area.

l_api_mycomp ?=wd_this->wd_get_api ( ).

l_wd_message_area = l_api_mycomp->get_message_area ( ).

l_wd_message_area->set_display_attributes (

i_for_all_instances =''

i_msg_lines_visible ='0'

i_use_toggle_area =' '

i_show_only_current ='' ).

设置参数说明:

i_use_toggle_area = '':New design of the message area (default setting)

i_use_toggle_area = 'X':Old design of the message area (with the toggle area)

i_msg_lines_visible = 0:All messages are immediately visible (default setting)

i_msg_lines_visible = <x>:x > 0. Only x messages are immediately visible; the rest become visible by scrolling.

i_show_only_current = 'X':Together with i_use_toggle_area = '' this means that no message log can be displayed (default setting)

i_show_only_current = '':Together with i_use_toggle_area = '' this means that a link takes you to where the message log can be displayed

Message使用实例:

在COMPONENTCONTROLLER中创建公共方法SHOW_MSG;

输入参数MSG,Type:STRING;

输入参数MSG_TYPE,Type:CHAR1;

 

示例:

  "显示信息
  DATA:l_current_controller TYPE REF TO if_wd_controller.
  DATA:l_message_manager    TYPE REF TO if_wd_message_manager.
  
  "获取message manager
  l_current_controller ?= wd_this->wd_get_api( ).
  CALL METHOD l_current_controller->get_message_manager
    RECEIVING
      message_manager = l_message_manager.

  IF msg_type = 'S'.
    "report message
    CALL METHOD l_message_manager->report_success
      EXPORTING
        message_text = msg.
  ELSEIF msg_type = 'E'.
    "report error
    CALL METHOD l_message_manager->report_error_message
      EXPORTING
        message_text = msg.
  ELSEIF msg_type = 'I'.
    "report information
    CALL METHOD l_message_manager->report_message
      EXPORTING
        message_text = msg.
  ENDIF.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

偶是不器

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值