cancel
Showing results for 
Search instead for 
Did you mean: 

Navigating away from Web Dynpro after warning.

Former Member
0 Kudos

Hi Experts,

I wanted to see if anyone can shed light on something I've been trying to implement. I'm working with NWDS 7.0.18

I developed a collection of WDP Java apps that reside in the same workset.

While working in one of the apps, if the user clicks a link to another app in the detailed navigation area and they haven't saved what they have been doing in the current app, then I want to display a message like: "You haven't saved you worked, are you sure you want to leave?? YES/NO"

If the user clicks yes, how do I navigate them to the app they clicked on? Or the role they clicked on? Or the workset they clicked on? I have put the above message in the wdDoExit() method of the View controller. The method checks for unsaved changes and if so, displays the message. I have two event handlers YesExit and NoExit. NoExit does nothing, what do I need to put in YesExit??

Any help is greatly appreciated.

Thanks

MM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I'm not sure about this, I remember reading months ago when I first started with WDP.

If you set the lifespan of your view instance to when_visible, whenever the user navigates "out" of your view it will executes the wdDoExit method.

Maybe you can do your code in there, but I'm not sure how you can cancel the request.

Regards,

Daniel

christiansche
Active Participant
0 Kudos

Hi,

have you tried "work protect mode"? I don't know, if it works, when work protect mode is set in the onExit function, but give it a try.

The first example demonstrates how to define the work-protect mode level:

// Define the needed level. The level can be switched during

// the application lift time, i.e. it can for example be

// switched for different views.

WDPortalWorkProtectMode.setApplicationDirtyControl(

WDApplicationIsDirtyMode.NONE);

WDPortalWorkProtectMode.setApplicationDirtyControl(

WDApplicationIsDirtyMode.APPLICATION_ONLY);

WDPortalWorkProtectMode.setApplicationDirtyControl(

WDApplicationIsDirtyMode.STANDARD);

The second example demonstrates how to define the u201Cdirty stateu201D of an application:

// Set the u201Cdirty stateu201D to YES, i.e. the application is dirty and

// a navigation should be launched in a new window to make sure that

// no data is lost

WDPortalWorkProtectMode.setApplicationDirty(true);

// Set the u201Cdirty stateu201D to FALSE, i.e. the application state is u201Ccleanu201D

// and therefore the navigation is launched inplace and the

// running application is left.

WDPortalWorkProtectMode.setApplicationDirty(true);

Here is the document, i got this code from with some explanations about work protect mode: http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a891e490-0201-0010-fb99-b7e4f5dda2ec&override...

best regard,

Christian