cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to detect when a user navigates away from a webdynpro page?

PaulHodgdon
Participant
0 Kudos

I need to detect when a user navigates away to stop a timer set for the purpose of logging out a user after a certain amount of time. If they click exit I can capture the event but if they click another tab then I cannot. I know when in edit mode the SAP code for work protect will catch that and ask if you would like to save, but I don't think I have any access to that code. Does anyone know how they accomplish this and can it be done if the user is just looking at data also?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Yes, you can do that using Exit Hook method wdDoExit

We have used following hook to unlock the locked record of database table, which was open in edit mode.

//@@begin javadoc:wdDoExit()
  /** Hook method called to clean up controller. */
  //@@end
  public void wdDoExit()
  {
    //@@begin wdDoExit()

	wdComponentAPI.getMessageManager().reportSuccess("exit called");
    
    //@@end
  }

Former Member
0 Kudos

see if we can use the exit plug

Qualiture
Active Contributor
0 Kudos

Hi Paul,

It is certainly possible to use the work protect mode in custom Web Dynpro Java applications.

Have a look at http://help.sap.com/saphelp_nw72/helpdata/en/4a/3c4a0b0f841cbbe10000000a42189c/frameset.htm

Also, the workprotect level can be switched during runtime, which might come in handy when handling different views in your application

Hope this helps!

Robin

PaulHodgdon
Participant
0 Kudos

Is there a hook to running a piece of custom code when the work protect mode is triggered. Specifically I need to fire an EPCM event when the user navigates away.

Thanks for your help

PaulHodgdon
Participant
0 Kudos

or if that is not possible is there is there any way I can create something custom to know that the dirtymode has been activated?

Qualiture
Active Contributor
0 Kudos

Hi Paul,

Have a look at this EPCM WorkProtect document http://help.sap.com/saphelp_nw73/helpdata/en/4a/2918293e7b044ee10000000a421937/content.htm it might be of help

You may catch the EPCM.getDirty() state and upon true, do your magic

Cheers,

Robin