cancel
Showing results for 
Search instead for 
Did you mean: 

[Portal] Clean-up when navigating away

guillaume-hrc
Active Contributor
0 Kudos

Hi, 

I know Work protect mode can be used to ask users whether they want to leave the current page or not.

Nevertheless, assuming that they choose 'Yes', is there a way to catch this and do some clean-ups on the server-side?


I doubt there is some 'onUnload' function somewhere but by registering some Portal events, would I be able to catch the user closing the web browser or navigating away from my Web Dynpro app?

Is there a 'hook' I can leverage in the Distributed Session Termination mechanism...?

Thanks in advance for your help.

Best regards,

Guillaume

Message was edited by: Guillaume Garcia

Accepted Solutions (1)

Accepted Solutions (1)

Abhijeet-K
Active Participant
0 Kudos

Hi Guillaume,

The WDDOEXIT method of component controller, view and window can be utilised for clean up. Additionally, the WDDOONCLOSE method of window can be used. However, bear the following in mind:

  • These methods are WD life cycle methods. This means, that they will be called by WD framework as it finds suitable, including session expiry.
  • The browser close might fire the method, though I am not sure, but most certainly won't let you prevent closing the window, if that's your objective. You may gamble with some bit of JavaScript, if your organisation policies allow them to be written, to abort closure.
guillaume-hrc
Active Contributor
0 Kudos

Hi,

Actually, I don't want to prevent the closing of the window, I just want to have enough time to do some stuff on the server-side (free some resources that might get flagged as used, and so on...).

Unfortunately, releasing locks is not enough in our case and we have to perform a kind of 'custom-rollback' (I know it doesn't sound good to me too).

Thanks.

Best regards,

Guillaume

Abhijeet-K
Active Participant
0 Kudos

Hi Guillaume,

It's very good that you plan to implement a clean-up within your code, which, BTW, is a recommended practice. You can surely use the methods I listed earlier for your stated objective. In case you feel it might cause the user to get a oh-its-hung feel, make a asynchronous call to a FM within these methods and write the clean-up code.

guillaume-hrc
Active Contributor
0 Kudos

Hi,

I like the asynchronous FM call suggestion. 

Best regards,

Guillaume

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Guillaume,

We had the same problem and SAP replied that we had to clean iview parameters in order that SAP Netweaver Portal could work properly.

Indeed, in the application name, we added a parameter "&sap-language=EN" after the name of our application to force the iview in English language. (When we put English in the logon language it did not work).

So now it works, and a trick to oblige the portal to open in the English language, is to put a language that is not customized in the portal like Danish for us.

example:

Application name = xxx_td_upload  (suppression of &sap-language=EN)

Logon language = Danish

😉

guillaume-hrc
Active Contributor
0 Kudos

Jonathan,

You can force the language on the iView side through a dedicated property:

http://help.sap.com/SAPhelp_nw73/helpdata/en/49/86ff00feb92223e10000000a42189d/content.htm

Best regads,

Guillaume

guillaume-hrc
Active Contributor
0 Kudos

Hi,

After some thourough investigations, the Portal DSM is sending the sap-sessionCmd = USR_ABORT and the ABAP backend replies with a sap-session = RELEASED and the message 'Application terminated...' but the session exists (SM04) and the locks are not released (SM12).

Best regards,

Guillaume