其他分享
首页 > 其他分享> > Web Dynpro for ABAP(13):Messages

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.

 

标签:Web,wd,area,manager,Reports,REPORT,ABAP,Dynpro,message
来源: https://www.cnblogs.com/tangToms/p/16365498.html