cancel
Showing results for 
Search instead for 
Did you mean: 

Problem showing a PopUp Window and window reference

former_member276384
Participant
0 Kudos

Hi Web Dynpro ABAP experts,

I have a problems showing a popup window (asking if the changes should be saved or not) associated with a WebDynpro Field (month and year).

I have a method with some validations that is called on two places:

1 - "on enter" event handler

2 - on the event handler of an OVS search help (yes button)

When the method is called in (1), the popup window is displayed ok. When is called on (2) after the selection of the new value of the OVS the popup is never displayed. It's the same method, so it's the same code and if it works on (1) it should work on (2), but it does'nt.

I guess that it's related with the window manager, because with (1) the popup has the main window as window manager and with (2) the window manager is the OVS window that probably has been destroyed.

How can I display the popup for (1) and (2)?? Thanks in advance.



.... more code here....

      l_cmp_api        = wd_comp_controller->wd_get_api( ).

      l_window_manager = l_cmp_api->get_window_manager( ).

      CLEAR lv_string.
      MESSAGE s077(zxau) INTO lv_string.
      INSERT lv_string INTO TABLE l_text.                   "#EC *

      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_question
                    window_title    = 'Save'
                    window_position = if_wd_window=>co_center ). "#EC *

      l_api = wd_this->wd_get_api( ).

      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_yes
                   action_name       = 'POP_YES_SAVE'
                   action_view       = l_api
                   is_default_button = abap_true ).

      l_popup->subscribe_to_button_event(
                   button            = if_wd_window=>co_button_no
                   action_name       = 'POP_NO_SAVE'
                   action_view       = l_api
                   is_default_button = abap_false ).

      l_popup->open( ).

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jordi,

You are right, i would have had the same expectation as you do. Regarding the window manager, you are calling the wd-comp_controller->get_api( ). So i do not think that the second time OVS window manager is used (my assumption might be wrong ).

Have you seen in debug that this code is getting executed and you do not see the popup window ?.

Perhaps you can see through for sap notes regarding this and raise a OSS ticket with SAP.

former_member276384
Participant
0 Kudos

Hi Baskaran,

thanks for your response. Now I'm looking if it's possible to get the reference to the main window.

Regards,

Jordi

gill367
Active Contributor
0 Kudos

HI

here is how you can solve this.

If i am not worng you want to open the popup as soon as you select some value in ovs list and you are returning to the main

window.

IN between you want one popup and then you want to go to the main screen.

for achieving this, do as follows.

1. Create the window instance in the wddoinit method itself like as shown below.


  data lo_window_manager type ref to if_wd_window_manager.
                     data lo_api_component  type ref to if_wd_component.
                     data lo_window         type ref to if_wd_window.

                     lo_api_component  = wd_comp_controller->wd_get_api( ).
                     lo_window_manager = lo_api_component->get_window_manager( ).
                     lo_window         = lo_window_manager->create_window(
                                        window_name            = 'ZPOPUP'
*                                       title                  =
*                                       close_in_any_case      = abap_true
                                        message_display_mode   = if_wd_window=>co_msg_display_mode_selected
*                                       close_button           = abap_true
                                        button_kind            = if_wd_window=>co_buttons_ok
                                        message_type           = if_wd_window=>co_msg_type_none
                                        default_button         = if_wd_window=>co_button_ok
                                        ). 

2. create an attribute named window of type ref to IF_WD_WINDOW.

3. in the wddoinit the set this attribute's value with the window you have created.

like as follows

wd_context->set_attribute( name = 'WINDOW'

VALUE = lo_window ).

4. create one more attribute say OPEN type string.

5. set this attribute to YES in the ON_OVS eventhandler, where you want to open the popup like this.


   wd_context->set_attribute(
    EXPORTING
      name =  `OPEN`

      value = 'YES' ).

.

6. now go to the wddomodify method and there wirte the code to check value of OPEN and if yes then open the winodw

as shown below.


DATA lv_win LIKE ls_window-win.
 data lv_open type string.
  wd_context->get_attribute(
    EXPORTING
      name =  `WINDOW`
    IMPORTING
      value = lv_win ).

  wd_context->get_attribute(
    EXPORTING
      name =  `OPEN`
    IMPORTING
      value = lv_open ).

if lv_open eq 'YES'.
 lv_win->open( ). 
  endif.
 WD_context->set_attribute(
 name =  `OPEN`
value = 'NO' ).

thats it.

IT will do the desired task.

Thanks

sarbjeet singh

Answers (0)