cancel
Showing results for 
Search instead for 
Did you mean: 

Catch wd application closing

Former Member
0 Kudos

Hello,

I have a web dynpro application that allows to change some data. I collect the changes that the user made, and he can save them by click on save button. If the user click on the close button (of the browser), I want to show a popup window that asks the user if he wants to save the changes before the closing. The wdDoExit method of the view and the window are called after the browser closed, so I can't show the popup window on them.

Someone can help me?

Best regards,

Ednri.

Accepted Solutions (0)

Answers (1)

Answers (1)

Gowtham
Contributor
0 Kudos

Hi Ednri,

Call the Confirmation popup from the save button with Yes/No button and capture the action from the popup , please find the confirmation popup code.


  DATA l_cmp_api                  TYPE REF TO    if_wd_component.

  DATA l_window_manager     TYPE REF TO    if_wd_window_manager.

  DATA l_popup                      TYPE REF TO   if_wd_window.

  DATA l_text                         TYPE                 string_table.

  DATA l_api                          TYPE REF TO    if_wd_view_controller.

  l_cmp_api        = wd_comp_controller->wd_get_api( ).

  l_window_manager = l_cmp_api->get_window_manager( ).

    INSERT `Need Confirmation to submit the Details?` INTO TABLE l_text.

    l_popup = l_window_manager->create_popup_to_confirm(

                  text            = l_text

                  button_kind     = if_wd_window=>co_buttons_yesno

                  message_type    = if_wd_window=>co_msg_type_information

                  window_title    = 'Confirmation Window'

                  window_position = if_wd_window=>co_center

                  default_button  = if_wd_window=>co_button_yes ).

    l_api = wd_this->wd_get_api( ).

    l_popup->subscribe_to_button_event(

                 button            = if_wd_window=>co_button_yes

                 action_name       = 'OK_SAVE'

                 action_view       = l_api ).

    l_popup->subscribe_to_button_event(

           button            = if_wd_window=>co_button_no

           action_name       = 'NO'

           action_view       = l_api ).

    l_popup->open( ).

Here in the code action name will be binded with button , create some action copy your save button code into it then whenever user selects Yes only that point of time save action will be triggered.

after the save button code you can call Exit method to close the browser.

- Gowtham

Former Member
0 Kudos

Thank you, but my purpose is to show the popup window when the user close the browser. Not when the user clicks on a button in the application.

Gowtham
Contributor
0 Kudos

Hi Ednri,

As per my understanding, the only way to do some action when closing the Browser is WDDOEXIT,

If you write some piece of code here then it will get executed only after the browser is getting closed hence It will be possible to execute some normal set of tasks but not possible for opening popup.

- Gowtham