Skip to Content
0
May 28, 2020 at 10:03 AM

How to close web dynpro dialog box after click on button

180 Views Last edit May 28, 2020 at 10:05 AM 3 rev

I created a popup in a web dynpro to let the user chooses the correct material. I used the following code to do that:


lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).

ls_canc_action-action_name = '*'.

lt_buttons = lo_window_manager->get_buttons_ok(
).

lo_window = lo_window_manager->create_and_open_popup(
window_name = 'TABLE'
component_usage_name = 'CH_MAT'
title = 'Materiali per lotto'
message_type = if_wd_window=>co_msg_type_none
message_display_mode = if_wd_window=>co_msg_display_mode_selected
buttons = lt_buttons
cancel_action = ls_canc_action
).

lr_view_controller = wd_this->wd_get_api( ).

CALL METHOD lo_window->subscribe_to_button_event " register event before opening window
EXPORTING button = if_wd_window=>co_button_ok
action_name = 'OK'
action_view = lr_view_controller.

lo_window->open( ).

On action 'OK' method I wrote the code to get the selected material and then I tried to exit from the popup, but that didn't work. The popup closing work only after pressing the 'X' on right corner of the popup.

How can I close the dialog box also after 'OK' pressing?

Thanks a lot,

Michaela