cancel
Showing results for 
Search instead for 
Did you mean: 

How can we create a popup window for confirmation while clicking of button

Former Member
0 Kudos

HI Friends,

I am creating a application, In which I want to create a popup window for confirmation on clicking of a button.

I also need two buttons on popup window i.e. 'Yes' & 'No'.

On yes i want to perform some operation and on No i want to cancel that operation.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Narendra

Please go through this wiki

https://wiki.sdn.sap.com/wiki/display/stage/DialogboxesinWebDynproABAP

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

Please search SCN on same before you post as there are many related threads on the same..........

Regards,

Lekha.

former_member40425
Contributor
0 Kudos

Hi,

Use below code in OnAction of your button.

data: l_cmp_api type ref to if_wd_component,
l_window_manager type ref to if_wd_window_manager,
l_popup type ref to if_wd_window,
l_text type string_table,
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( ).

/*enter your message here*/

Append `Your Text` 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_question
window_title = 'Test: Popup to confirm'
window_position = if_wd_window=>co_center ).

l_api = wd_this->wd_get_api( ).

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

l_popup->open( ).

Now create a Action With name YES and write the code for the functionality which you want to achieve on click of YES button.

I hope it helps.

Regards,

Rohit

Former Member
0 Kudos

here for the popup , u need to create one window , say

W_POPUP as in my code above and in that u need to embed that view , which shud appear as popup

for embedding the view double click on the window W_POPUP and now under the windows tab u cn right click n select embed view ( this is ur pop up view)

now in the method, "ONACTIONOK_POPUP" (this action 'OK_POPUP' u wud be creating in the same view , where ur button is there), write

the appropriate action which shud happen on click of yes button in the generated popup

do revert back in case u need any assistance

rgds,

amit

Former Member
0 Kudos

Hi Narendra,

try using the following code in ONACTION of ur button for popup :


..
* Popup
   *  Generate Popup
    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          = 'W_POPUP'
     window_position = if_wd_window=>co_center 
      message_display_mode = if_wd_window=>co_msg_display_mode_selected
      button_kind          = if_wd_window=>co_buttons_yesno
      message_type         = if_wd_window=>co_msg_type_none
      default_button       = if_wd_window=>co_button_yes
      ).
    DATA:  l_api TYPE REF TO if_wd_view_controller.

    l_api = wd_this->wd_get_api( ).
    " subscribe action for Ok button
    lo_window->subscribe_to_button_event(
                 button            = if_wd_window=>co_button_yes
                 action_name       = 'OK_POPUP'
                 action_view       = l_api
                 is_default_button = abap_true ).

    lo_window->open( ).

regds,

amit