cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a reply from a pop up to confirm

Former Member
0 Kudos

Hi.

I was giving a popup to the user to confirm something using create_popup_to_confirm of the window manager.

Now, problem is I coded it in one method of the view.

I want to call this popup method now at different user interaction stages of the view - for eg loss of data, confirm save, confirm send mail etc. So I'd call this popup with different question text preferably.

Problem is that what I understand is that I have to subscribe to YES/NO event, and I can handle them at the YES/NO event handler only.

But I want to do different things based on from where the action was triggered.

For eg. If user pressed cancel without saving, after the popup i want to navigate to the start menu. If user pressed save and a mail is being sent, after the mail confirmation popup, i want to go to a different view.

This is just an example. Basically I want to know how to get the return value of what user has pressed in the popup.

If I write anything after the popup, that code is executed first before the popup is called.

Please note I know that we have to write the handler code in the event handler method.I wanted the return value "yes/no" after my popup has been showed at some point in the program.

Thanks in adv.

Accepted Solutions (0)

Answers (4)

Answers (4)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Aishi,

Better you create a view and place it in a window and show the same as popup,

and handle what ever you want inside the view.

This is the code to be written in the view which is embedded in the window to close popup window,

data: lr_controller type ref to if_wd_view_controller.

data: lr_window_ctrl type ref to if_wd_window_controller.

data: lr_window type ref to if_wd_window.

lr_controller = wd_this->wd_get_api( ).

lr_window_ctrl = lr_controller->GET_EMBEDDING_WINDOW_CTLR( ).

lr_window = lr_window_ctrl->get_window( ).

lr_window->close( ).

Regards

Abhimanyu L

Message was edited by:

Abhimanyu Lagishetti

Former Member
0 Kudos

Hi Aishi ,

Please see Package SWDP_TEST .See WD component WDR_TEST_CHAT .See pop up in that Application .May you will get some Idea .

Cheers

Parag

Former Member
0 Kudos

Hi Aishi,

Even I had the same kind of requirement, where I had to use the same event handlers when the popup was triggered from different places.

In this case in the method being triggered by the button which calls the popup, I have stored the reference of the ID in a global variable ( this ID will be the button name). This ID will be available as a string in the importing parameters of the method being triggered by the button.

Then in the event handlers of the popup I am doing a case on the ID (stored as global variable) and checking for all the possible values and handling the functionality accordingly.

Hope this helps in your case.

Regards,

Pratibha.

Former Member
0 Kudos

Hi Aishi.

AFAIK what you want is not possible. You have to use the event handler methods.

But you can handle it. Just an example:

I have a method which performs a navigation from one component to another.

If the component is dirty the user should confirm the navigation. The navigation

method takes the parameter has_confirmed as boolean.

User clicks link to navigate->method is called with has_confirmed = abap_false.

Method checks if component is dirty and if so pops up confirmation window and returns imediatly.

Now user confirms and corresponding event handler is called. Here I check whetrher user pressed yes and then call navigation methods again with has_confirmed = abap_true. Navigation will be perormed.

This is just an example on how you can handle this problem.

Hopes this helps a bit.

Cheers,

Sascha