Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to trigger Logoff apart from closing browser

Hi all,

I have implemented session handling by copying the page session_single_frame.htm from the system bsp into my application. This works fine if the user closes the browser or types in another url. Their SAP session ends properly and they get a small window, only very briefly, which says Ending user session.

I am stuck though on how to implement a logoff button to do the same thing. I can get it to end the session and navigate to a default url. I think it is still under the control of the javascript in session_single_frame.htm though. This is because they don't get the Ending user session window when they click the Logoff button. They get this Ending user session window later when they next next type in a url or close the browser. This is confusing to them.

How do I get my Logoff button to do everything, that is, end the session, navigate to my new url and get the Ending user session window straight away rather than later? I have only recently learnt javascript and I haven't yet mastered it. I think my problem is not understanding it well enough.

My logoff button does the following:

navigation->exit( 'logoff.htm' ).

Logoff.htm contains the following which I copied from another SAP page. URL is a page attribute which I set in OnInitialisation to the url I want to navigate to.

<html>

<head>

<title> Update Window </title>

</head>

<script language="JavaScript">

function exitBSPApplication()

{

<%

CLASS cl_bsp_login_application DEFINITION LOAD.

url = cl_http_utility=>escape_url( unescaped = url ).

%>

var url = "<%=CL_BSP_LOGIN_APPLICATION=>GET_SESSIONEXIT_URL( page = page ) %>";

url += "&<%=CL_BSP_LOGIN_APPLICATION=>CO_BSP_APPLICATION %>=<%=CL_BSP_LOGIN_APPLICATION=>SET_LOGOFF_URL_PARAM( url = url ) %>";

self.location.href=url;

}

</script>

<body onload="exitBSPApplication()">

<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">

<tr>

<td align="center">

<span style="font-family:Arial;font-size:x-small">

Save Window...

</span>

</td>

</tr>

</table>

</body>

</html>

I have also tried using the default.htm page from system ITSM. I could not get this to end the session if the user closed the browser though. I tried both onUnLoad as well as onBeforeUnload. Neither worked so I went back to using session_single_frame.htm from system application.

Thanks for any help you can provide.

Christine

Former Member
Not what you were looking for? View more on this topic or Ask a question