cancel
Showing results for 
Search instead for 
Did you mean: 

How call popup window from component controller & handle subscribe_to_button_event

I found this issue in some scenario, and that is how I've resolve.

Scenario. Call a Popup window from the component-controller not from a the view.

METHOD wddoinit.

DATA: lo_popup_window TYPE REF TO if_wd_window,
lo_window_manager TYPE REF TO if_wd_window_manager,
lo_cmp_api TYPE REF TO if_wd_component,
lt_text TYPE string_table,
ls_text TYPE string.

lo_cmp_api = wd_this->wd_get_api( ).
lo_window_manager = lo_cmp_api->get_window_manager( ).

ls_text = 'Do you want to continue?'.
INSERT ls_text INTO TABLE lt_text.

CALL METHOD lo_window_manager->create_popup_to_confirm
EXPORTING
text = lt_text
button_kind = if_wd_window=>co_buttons_yesno
default_button = if_wd_window=>co_button_no
window_title = 'Information'
close_button = abap_false
RECEIVING
result = lo_popup_window.

CALL METHOD lo_popup_window->popup_to_confirm->subscribe_to_button_event
EXPORTING
controller = lo_cmp_api
button = if_wd_window=>co_button_no
handler_name = 'ACTION_BTN_NO'.

CALL METHOD lo_popup_window->popup_to_confirm->subscribe_to_button_event
EXPORTING
controller = lo_cmp_api
button = if_wd_window=>co_button_yes
handler_name = 'ACTION_BTN_YES'.

lo_popup_window->open( ).

ENDMETHOD.

*--------------------------------------------------------------------------------------*

In the methods set the event handlers as follow.

*--------------------------------------------------------------------------------------*

When you run the program...

Regards!! Bye 😃

Accepted Solutions (0)

Answers (0)