0

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.

enter image description here

-----------------------------------------------------------------------------------

When I run the program

enter image description here

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
EdgarMorales
  • 29
  • 1
  • 4
  • 1
    Hi. I am not sure, but I guess you should rewrite it in 2 parts: first create a question, don't say that you have an answer, then provide an answer to your own question. – Sandra Rossi Oct 30 '18 at 09:45

1 Answers1

0

Following steps will assist you.

  1. Create method popup_window inside component controller having method paramter ir_vc type ref to if_wd_view_controller
  2. Write above code in the question inside method popup_window.
  3. add below code inside view where you want to call popup.

Code in view:

DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
lo_componentcontroller = wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->call_popup( ir_vc = lo_api_main ).

regards,

Umar Abdullah

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Umar Abdullah
  • 1,282
  • 1
  • 19
  • 37