Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Participant

As you have probably found out already, the log off procedure explained on 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:

javascript: document.execCommand('ClearAuthenticationCache');

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.

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<script type="text/javascript">
function clearCache()
   window.setTimeout('document.execCommand("ClearAuthenticationCache", "false")',1500); 
  <body onload="clearCache()">
  <img src="?sap-sessioncmd=logoff" width="1" height="1">
  <h1 align="center">You have been logged off</h1>
  <div align="center">
      <input type="image" src="./Images/home.jpg" style="width:100px; height:100px;" onclick="window.location.href='start.htm';"/>

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...


     Logging onto BSP Applications

     Logging off BSP Applications

1 Comment
Labels in this area