cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger Logoff apart from closing browser

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member191062
Active Contributor
0 Kudos

Hello,

You can try to unload the most top fameset via a javascript code. The seesion ending mechanism is based on the onunload event of a frameset wich contains the actual page / frameset. >> Wenever you unload the pop-up will appear and the session will be terminated.

Regards,

Dezso