cancel
Showing results for 
Search instead for 
Did you mean: 

confirm popup triggered when leave current unsaved page

former_member214677
Active Participant
0 Kudos

hi, experts

the scenario is,

1. we edit initiative, the component is INI_MAIN

2. before saving the initiative, we click any link in the navigation bar,

3. then a confirm popup was triggered,

we want to know which action triggered the popup,

so we can modify the conditions under which the popup will be triggered or not.

thanks a lot.

oliver.

Accepted Solutions (1)

Accepted Solutions (1)

former_member214677
Active Participant
0 Kudos

hi,

thanks for your replies.

now we want to suppress the popup.

instead, before navigating to other view without saving, we want to throw an error "must click the save or cancle button before navigation".

so we have to find where the popup is triggered in the current component.

now, we find the component CRM_UI_FRAME where the popup is triggered in method EXECUTE_REDIRECT.

but the app class CL_CRM_UI_FRAME_APP_CONTROLLER is final, can't be redifined.

very appreciate for any suggestion.

oliver.

hongyan_shao
Active Contributor
0 Kudos

Hi Oliver,

I have to say if the changes is made in CL_CRM_UI_FRAME_APP_CONTROLLER, then all the applications besides initiative will have to go through that coding. It will be better to put into application specific.

I've checked in component INI_MAIN. Instead of CL_CRM_UI_FRAME_APP_CONTROLLER, please check

CL_CRM_UI_CORE_APPL_CONTROLLER instead, and in method an event was triggered in method EH_TRIGGER_NAVIGATION

and as Carsten mentioned, please check in

CL_MKTPRJ_WINDOW

ON_BEFORE_WA_CONTENT_CHANGE

And in this method there is coding:

* Save needed?
  lv_save_needed = lr_mktprj_tx_manager->check_save_needed( ).

* Trigger data loss popup if changes exist
  IF lv_save_needed = abap_true AND lr_main_entity IS BOUND.

    data_loss_handler->set_save_handler( lr_mktprj_tx_manager ).
    data_loss_handler->set_revert_handler( lr_mktprj_tx_manager ).
    data_loss_handler->trigger_data_loss_handling( ).

Actually for your requirement, you might have to try to look into this method. But it seems this class is also not included in normal enhancement set IMPL/CTXT/CNxx classes. Seems not able to use without modification. 😛

Hongyan

hongyan_shao
Active Contributor
0 Kudos

Hi Oliver,

I've run across wiki http://wiki.sdn.sap.com/wiki/display/CRM/How-to%20implement%20dataloss%20popup

thus I believe your requirement can have solution.

I've followed the steps in the above wiki to make changes in Implementation Class ZL_INI_MAIN_MAINWINDOW_IMPL which is an enhancement class CL_INI_MAIN_MAINWINDOW_IMPL in INI_MAIN.

And after that the event issued in

CL_CRM_UI_CORE_APPL_CONTROLLER

EH_TRIGGER_NAVIGATION

will trigger two methods, that is ON_BEFORE_WA_CONTENT_CHANGE

from CL_MKTPRJ_WINDOW

and my class ZL_INI_MAIN_MAINWINDOW_IMPL

Thus in Z class you have chance to overwrite the result in standard.

Firstly, you might have to clear the value in

DATA_LOSS_HANDLER->IF_BSP_WD_DATA_LOSS_HANDLER~HANDLE_DATA_LOSS

which was set to X in CL_MKTPRJ_WINDOW

Then start your own logic.

Hope this can help.

And happy new year to you!

Hongyan

Answers (4)

Answers (4)

former_member214677
Active Participant
0 Kudos

Hi, Hongyan

you are correct, very appreciate.

happy new year to you !

and happy new year to Carsten and Gangadhar ! thanks for your help.

oliver.

CarstenKasper
Active Contributor
0 Kudos

Oliver,

there is an event ON_BEFORE_WA_CONTENTAREA_CHANGE in a normal case the current window will have an event handler registered for this. Check the windows implementation class for a method containing "DATA_LOSS" in the name. SAPs' developers seem to always name it this way.

cheers Carsten

hongyan_shao
Active Contributor
0 Kudos

Carsten is correct.

I've made another analyzing with the sales order changes and navigate away.

I can see an event before_workarea_content_change is triggered, and method

CL_CRM_BT_H_WINDOW

ON_BEFORE_WA_CONTENT_CHANGE

Thus would like to say that maybe you will have to check whether

ON_BEFORE_WA_CONTENT_CHANGE

or

ON_BEFORE_WA_CONTENTAREA_CHANGE mentioned by Carsten

hongyan_shao
Active Contributor
0 Kudos

Hi,

What I can see is the call stack which launches the data loss popup

METHOD LAUNCH_DATALOSS_DIALOG CL_CRM_UI_FRAME_APP_CONTROLLERCP

METHOD EXECUTE_REDIRECT CL_CRM_UI_FRAME_APP_CONTROLLERCP

METHOD DO_REQUEST CL_BSP_WD_VIEW_MANAGER========CP

METHOD DO_REQUEST CL_BSP_CTRL_ADAPTER===========CP

Not so sure whether this could help you regarding "modify the conditions under which the popup will be triggered or not".

Hongyan

Former Member
0 Kudos

Hi ,

Iam not clear with your requirement but in the component INI_MAIN the views INI_MAIN/OPOverview INI_MAIN/OVDetails have the event handler methods for the popup in the controller classes .Put a break point in these popup methods and see .

Regards,

Gangadhar.S