As you have probably found out already, the log off procedure explained onhttp://help.sap.com/saphelp_nw04/helpdata/en/6b/9d91d062cc52419f23926ff1bf2ad3/content.htm implies that you close the browser window.
Now, this becomes almost impossible when dealing with handheld devices like barcode scanners.
The scenario I’m going to refer to in this page is intended to SAP BSP developments for handheld devices running Windows Mobile and IE 6+.
So all you need to do is:
– close the current SAP session
– clear authentication cache.
1) Closing the current SAP Session
Logging off is extremly easy. Let’s say your bsp app has a page called logoff.htm. Just create a link to this page like
Sending the parameter ?sap-sessioncmd=logoff will start actually close the current connection, and if you check in SM04 TCODE you should no longer see any Plugin Http connections (or at least you’ll notice that one of them closes ).
Great so far, but there is another problem. If you hit refresh or do anything to make the BSP App pages reload, you’ll notice that the connection you just close, reopened because of the IE cache.
2) Clearing the authentification cache of IE
Clearing the authentification cache of IE is done by simply putin the following JS command in the URL Bar of the IE browser:
Note: This command is not compatible with all browsers (like chrome) and probably not all versions of IE. To test it, just put the above mentioned command in the address bar and run it. It should return “true”.
Also if this command is succesful, your BSP App should popup the logon dialog box again. Keep in mind that this won’t mean that the previous session was closed. It only means that IE no longer knows that you have an open connection.
Puting it all togheter:
Another problem that might come up is the order in which the two commands run (log of and clear cache).
-If you clear cache before logoff you’ll have the logon dialog box again, and thus create multiple connections.
-If you call the logoff parameter via url like:
your browser might not run the JS function.
So you have to run them kinda at the same time, and in the following order:
– Log Off
– Clear Authentification Cache
Following is the code of the logoff page.
Note that the link to my page is simply
witout sending the logoff command.
In the page you have the clearCache() JS function that runs delayed for 1.5 seconds and it clears the authentication cache, and the
<img src="?sap-sessioncmd=logoff" width="1" height="1">
will run the logoff command for your app.
So this is it…