cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help for Popup Confirmation message with TWO Buttons

Former Member
0 Kudos

Hi,

In my application i want to delete rows from the table. I am having DELETE button when pressing the button i need confirmation message to delete YES and NO button

if yes they pressed I have to call delete the record method / event. iF no nothing.

pl help .

thanks in advance.

sri

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

REFER TO THIS EXAMPLE WDR_TEST_POPUP_TO_CONFIRM.

Former Member
0 Kudos

hi,

I am using this code one of my action and created two actions YES and NO.

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( ).

insert `Data where changed` into table l_text. "#EC *

insert `Do you want to save?` into table l_text. "#EC *

l_popup = l_window_manager->create_popup_to_confirm(

text = l_text

button_kind = if_wd_window=>co_buttons_yesnocancel

message_type = if_wd_window=>co_msg_type_question

window_title = 'Test: Popup to confirm'

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 = 'YES'

action_view = l_api

is_default_button = abap_true ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_no

action_name = 'NO'

action_view = l_api

is_default_button = abap_true ).

l_popup->subscribe_to_button_event(

button = if_wd_window=>co_button_cancel

action_name = 'CANCEL'

action_view = l_api

is_default_button = abap_false ).

l_popup->open( ).

but it is dumping.

error is

Note

The following error text was processed in the system DP1 : Action &OBJECT_ID& does not exist

The error occurred on the application server p2pdev01_DP1_12 and in the work process 0 .

The termination type was: RABAX_STATE

The ABAP call stack was:

Method: IF_WDR_RR_CONTROLLER~GET_ACTION of program SAPLWDR_RUNTIME_REPOSITORY

Method: GET_ACTION_INTERNAL of program CL_WDR_CONTROLLER=============CP

pl suggest

sri

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Did you only create YES and NO. You reference three actions in your code - you also have CANCEL. The error is that the action doesn't exist. You either missed an action or there is a typo in the name of one of the actions somewhere.

Former Member
0 Kudos

hi sri san.......

you have not created the action called cancel. so only you are getting this error.

---regards,

alex b justin

Former Member
0 Kudos

Hi all,

Thanks for the reply. Now I am getting popup. when the popup is coming my view is shadowed . This is the the way it will come normally.

thanks,

sri

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Yes this is the way that popups work in Web Dynpro. The dialog window is modal and it has focus and control. The main window does get slightly shadowed because only the popup window can accept input.

Former Member
0 Kudos

Hi,

Thanks for the help.

bye

sri

Former Member
0 Kudos

thanks for the replies. my problem has solved with your guidance.

Former Member
0 Kudos

hi sri san....

first you should call the method create_popup_toconfirm method in if_wd_window_manager... then you must create an action name. then you should use the method subscribe_to_button_event method in if_wd_window.. to get the button that has been clicked.

---regards,

alex b justin

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There are built in confirmation dialogs supplied by SAP:

[http://help.sap.com/saphelp_nw70/helpdata/EN/43/c2283b2320332ce10000000a11466f/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/EN/43/c2283b2320332ce10000000a11466f/frameset.htm]

Former Member
0 Kudos

Hi,

Thanks for your reply. If the user selects YES how to call the concerned method or event for this action.

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->subscribe_to_button_event(

button = if_wd_window=>co_button_no

action_name = 'NO'

action_view = l_api

is_default_button = abap_false ).

Where I can mention the method.

Thanks,

sri

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

'YES' and 'NO' in the action_name parameter from the example are custom actions that you create. Each custom action will have its own event handler generated for it. So just create a custom action and in the event handler put your coding or call an existing method from that event handler.

Former Member
0 Kudos

Goto the "Actions" tab of your view and define the necessary actions there. In this case, it will be 2 actions named 'YES' and 'NO'. Then in the methods tab, you can find the methods ONACTIONYES and ONACTIONNO created. Put yout event handling code in there.

Regards,

Nithya