on 02-20-2014 12:53 PM
Hiya,
I have a popup screen that looks like this:
The user enters some data, saves it and then closes the popup window - via the cross-box in the top-right corner..
Nice and simple but uh-oh sometime the users forget to press save and close the popup window and so loose all their data.
Is there a way to do some checking when the window is closed?
I'd liek to issue a popup to say are you sure you want to exit without saving.
I'd be interested to hear any ideas you migth have.
Many thanks!
Hi Robert,
Yes, you can register the close action of a window to a custom action in your view.
Your requirement can be achieved as below
- Create an action 'CLOSE' in your view
- Collect the popup window reference into view attribute wd_this->go_window
i.e. if you set it as view attribute you can access it in any other method if required
- Set the "OnClose " action of a popup window as below
wd_this->go_window->set_on_close_action(
EXPORTING
view = WD_THIS->WD_GET_API( )
action_name = 'CLOSE'
).
- Now, go to event handler method ONACTIONCLOSE in methods tab and implement your logic to create a popup for confirmation by using method
lo_window_manager->create_popup_to_confirm(
Upon close action on popup window, the event handler method ONACTIONCLOSE will be called
Hope this helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Rama - that's great.
Do you know where I write the following?
wd_this->go_window->set_on_close_action(
EXPORTING
view = WD_THIS->WD_GET_API( )
action_name = 'CLOSE'
).
Is this placed after the popup is called i.e. after
lo_window | = lo_window_manager->create_window( | |
window_name | = 'W_RFQ_UPDATE' | |
title | = lv_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_button_none | |
* | button_kind | = if_wd_window=>co_buttons_close |
message_type | = if_wd_window=>co_msg_type_none | |
default_button | = if_wd_window=>co_button_none | |
). |
lo_window->open( ). |
Or does that code in the actual popup view somehwere?
Hi Robert,
Please modify the code as below
wd_this->go_window | = lo_window_manager->create_window( | |
window_name | = 'W_RFQ_UPDATE' | |
title | = lv_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_button_none | |
* | button_kind | = if_wd_window=>co_buttons_close |
message_type | = if_wd_window=>co_msg_type_none | |
default_button | = if_wd_window=>co_button_none | |
). |
wd_this->go_window->set_on_close_action(
EXPORTING
view = WD_THIS->WD_GET_API( )
action_name = 'CLOSE'
).
wd_this->go_window->open( ). | |
Hope this helps you.
Regards,
Rama
Hi Robert,
You can replace WD_THIS->WD_GET_API( ) as below
data lo_view_controller type ref to if_wd_view_controller.
lo_view_controller = wd_this->wd_get_api( ).
wd_this->go_window->set_on_close_action(
EXPORTING
view = lo_view_controller
action_name = 'CLOSE'
).
If you still have issue, please check the parameter VIEW type in method SET_ON_CLOSE_ACTION. So, that you will find out what's the type of VIEW parameter.
Hope this helps you.
Hello Robert,
Try to find the screen name and goto SE41 -> Function list -> and find the function code of the cancel or EXIT icon.
In the screen flow logic code as when the function code is XXXX, raise a message.
Regards,
Thanga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.