Showing results for 
Search instead for 
Did you mean: 

How to cancel popup-close when pressing OK Button

Former Member
0 Kudos

Hi all,

I have a disturbing question within WebDynpro.

What i want:

Keep the popup screen open when the inputfield is initial or if the value is wrong (on domain level). (3 values on domain level: low, medium, high)

What i did:

I Create a popup and subscribed an action to the ok button:

   button = if_wd_window=>co_button_ok
   button_text = 'Ok'
   action_name = 'ADD'
   action_view = lo_view_controller

Within the onactionadd method i have placed a breakpoint but the program doesnt get past here if the inputfield is initial or if the inputfield has a bad value:

METHOD onactionadd.

When i leave the inputfield on the screen blank with


TYPE OF INPUT HELP: fixed values for domains

Then when i push the Ok button it just closes the popup.

I Tryed to make the inputfield mandatory and use the next method within the WDDOBEFOREACTION:

  CALL METHOD cl_wd_dynamic_tool=>check_mandatory_attr_on_view
      view_controller  = lo_view_controller
      display_messages = abap_true
      messages         = lt_messages.

but even that diddnt work 😕

View Entire Topic
Active Contributor
0 Kudos


here lo_view_controller is the parent view controller reference. I think you have created a view with one input field and embedded in popup window.! if so, why don't you take a button in the popup view and do validation in onAction of that button.

Remove the okcancle button of popup window and create a button in the popup view and do validation.

hope this helps u.,

Thanks & Regards,


Former Member
0 Kudos

Hi Kiran,

Yes the inputfield is within another view that i use as a popup, so i could use a self created button and close the popupscreen myself.

But by doing this i would have a different kind of layout and they would love to have same layout regarding the buttons and the little line that make some turns as you can see in the picture. Thats why my question regarding the cancelation of the popup. But if it is not possible this way, then ill create the buttons myself and try to represent the layout as possible

Thanks & Regards,


Former Member
0 Kudos

Hi micheal,

Pass the close_in_any_case parameter in create_window method as ABAP_FALSE.

and do your validations in your onactionOK method and close the window explicitly by coding,this would solve your problem.

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.
data lo_view           type REF TO if_wd_view_controller.

lo_view           = wd_this->wd_get_api( ).
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            = 'WIN2'
*                  title                  =
                  close_in_any_case      = abap_false
                    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

     BUTTON            = if_wd_window=>co_button_ok
*    BUTTON_TEXT       =
*    TOOLTIP           =
     ACTION_NAME       = 'OK'
     ACTION_VIEW       = lo_view

**now create a attribute in your view lo_win type ref to if_wd_window.

wd_this->lo_win = lo_window.

lo_window->open( ).

And in your onactionOK method check your input field and close it if your validations are passed.


     DATA lo_nd_inp TYPE REF TO if_wd_context_node.
     DATA lo_el_inp TYPE REF TO if_wd_context_element.
     DATA ls_inp TYPE wd_this->element_inp.
     DATA lv_attr LIKE ls_inp-attr.
*   navigate from <CONTEXT> to <INP> via lead selection
     lo_nd_inp = wd_context->get_child_node( name = wd_this->wdctx_inp ).

*   get element via lead selection
     lo_el_inp = lo_nd_inp->get_element(  ).

*   get single attribute
         name =  `ATTR`
         value = lv_attr ).

if lv_attr NE ''.
   wd_this->lo_win->close( ).


Former Member
0 Kudos

Hi Reddy,

Thanks, i oversaw the "close_in_any_case" parameter when creating the window

This resolved my problem.

Kind Regards,