cancel
Showing results for 
Search instead for 
Did you mean: 

How to use message area in a popup?

Former Member
0 Kudos

Hello,

when my WD application is started a popup with a list of setclasses appears where the user has to select exactly one. In case the user is doing some stupid things, for example doesn't select any line or selects all lines, I want to bring an appropriate message (on this popup). - How can I do this?

WD application is initialized

Window MAIN

View: MAIN, WDDOINIT -> Calls method in component controller to call popup (Meth. POPUP_SETCL_SELCT)

CompController

Method POPUP_SETCL_SELCT

- here the popup is created and called and an action BTN_SETCL_SLCT is registered

  • Create Window

  • ------------------------------------------------------------------- *

lr_window = lr_window_manager->create_window(

  • modal = ABAP_TRUE

window_name = 'W_SETCL_SELECT'

title = 'Select Setclass'

  • close_button = ABAP_TRUE

button_kind = if_wd_window=>co_buttons_okcancel

  • message_type = IF_WD_WINDOW=>CO_MSG_TYPE_NONE

  • close_in_any_case = ABAP_TRUE

  • message_display_mode = message_display_mode

  • default_button = default_button

).

  • Register Buttons/Actions

  • ------------------------------------------------------------------- *

lr_window->subscribe_to_button_event(

button = if_wd_window=>co_button_ok

button_text = 'Apply'

  • tooltip = tooltip

action_name = 'BTN_SETCL_SLCT'

action_view = ir_api

  • is_default_button = ABAP_FALSE

).

As this method was called from the MAIN window the registration of the action (BTN_SETCL_SLCT) is done for the MAIN Window/View.

Where is the best place to initialize the message area on the popup (currently it's done at WDDOINIT of the popup) and how can it be reached to bring an error message?

method WDDOINIT. (Popup)

data:

lr_api type ref to if_wd_view_controller,

lr_wd_message_area type ref to if_wd_message_area,

lr_window_ctrl type ref to if_wd_window_controller.

wd_comp_controller->fill_setclasses( ).

lr_api = wd_this->wd_get_api( ).

lr_window_ctrl = lr_api->get_embedding_window_ctlr( ).

if lr_window_ctrl is bound.

  • Initialize the message area

lr_wd_message_area = lr_window_ctrl->get_message_area( ).

lr_wd_message_area->set_display_attributes( i_for_all_instances = ' '

i_msg_lines_visible = '1'

i_use_toggle_area = ' '

i_show_only_current = ' ' ).

  • Show message area

lr_node = wd_context->get_child_node( 'ZCO_ATTR_DISPLAY' ).

lr_node->set_attribute( name = 'SETCL_MSG_AREA_VISIBLE'

value = cl_wd_uielement=>e_visible-visible ).

endif.

endmethod.

What needs to be done to register the popup event for the popup and not for the main WINDOW/VIEW?

How can I access the the reference to my popup from the main view so that I can show messages on it?

Can somebode give me a hint?

Thanks,

Thomas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Most of the methods in message_manager class has a parameter view. You can pass a view name or window name to display error on the view.

Try that out.