cancel
Showing results for 
Search instead for 
Did you mean: 

BSP Page logout problem

Former Member
0 Kudos

Hello @ all,

I have a BSP page with a logonpage which I have customized in SICF. Now I want to have a button where I can close application and get back to the logon screen. Can some one explain me how to realize this.I´m using this as startpage to my bsp:

<%@page language="abap" %>
<%
  " PLEASE READ INFO AT PAGE BUTTON!!!
  " This page should always used be as entry point into application.
  " Copy this page into your BSP application, and change line below.
  DATA: target_page TYPE STRING VALUE 'index.htm'.
  DATA: frame       type string.
  frame = sy-uzeit.
%>
<html>
<script language="JavaScript">

<%= runtime->GET_DOMAIN_RELAX_SCRIPT( ) %>
// Delete the cookie with the specified name.
function DelSso2Cookie(sName,sPath)
{
    var sso2Domain = location.hostname;
    if (location.hostname.indexOf(".")>0)
        sso2Domain = location.hostname.substr(location.hostname.indexOf(".")+1);
    p="";
    if(sPath)p=" path="+sPath+";";
        document.cookie = sName+"=0; expires=Fri, 31 Dec 1999 23:59:59 GMT;"+p + "domain="+sso2Domain+";";
}
function exitBSPApplication(newTargetUrl)
{
<%
  if runtime->session_manager->is_running = 0.
%>
img=new Image;
img.src = document.location.href+"/1x1.gif?sap-contextid=<%= cl_http_utility=>escape_url( runtime->server->session_id )%>&sap-sessioncmd=CANCEL";
<%
    " If you want to destroy the SSO2 cookie along with the server session,
    " please uncomment the function below
%>
//DelSso2Cookie("MYSAPSSO2","/");
for(i=0;i<5000;i++)for(e in document.all) tmp=e.innerHTML;
<%
  endif.
%>
    document.getElementById("<%= frame%>_FRAMESET").onunload = null;
    if(newTargetUrl) window.setTimeout('{document.location.href="'+newTargetUrl+'";}', 750);
}
</script>
<frameset id="<%= frame%>_FRAMESET" rows="*,0" onUnLoad="exitBSPApplication();" resize="no" framespacing="0" frameborder="0">
    <frame name="<%= frame %>_FRAME" src="<%= target_page%>" >
    <noframes>This browser does not support frames.</noframes>
</frameset>
</html>

Sorry for this beginner question but I´m new to BSP.

Thank you for any advice

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Do you need to add button for this layout?

If you have validations at client side you can go through the javascript otherwise it is always preferable to go by HTMLB.

Regards,

Azaz Ali Shaik.

Former Member
0 Kudos

Hallo Ali,

my second name is also Ali;)

The problem is as following: I have customized a login page via Transaction SICF in SAP Gui. And now, somewhere in my BSP App, I want to add a Button labeled Log Off, from where the User gets Back to the Logon page?!

I´ve look at some examples in BSP-Application samples like "system_private" and so on. In these examples are applications, where the application gets back to start, but without the need to relogon!?

Could anyone help me?

To Eddy->Thank you for your replies but after reading your weblogs, I stack in trying to get back to the Logonpage after logoff. How can I get back to my Logon page?

Thank you in advance and with best regards!

Mehmet

eddy_declercq
Active Contributor
0 Kudos

Hi,

The logon frame mentioned is always the entry point of the app. Lat's call it mian.htm as example.

Everything happens within a sub frame. You need to provide a button or menu-item. That'll call main.htm again but with target _top.

It'll log you off since you are leaving the page and you show the login aigain since it's the entry point.

Eddy

Former Member
0 Kudos

Hello Eddy,

thank you very much for your help!

Lets get in more detail:

My BSP-Application has three Pages

default.htm

main.htm and redirect.htm.

default.htm has following coding in its Layout Tab:

<%@page language="abap" %>
<%
  DATA: target_page TYPE STRING VALUE 'main.htm'.
  DATA: do_not_delete_sso2_cookie TYPE XFELD VALUE 'X'.
  DATA: appName TYPE STRING.
  DATA: ffs TYPE tihttpnvp, param type string, ff TYPE ihttpnvp.
  CONCATENATE runtime->application_namespace '/' runtime->application_name INTO appName.
  TRANSLATE appName TO LOWER CASE.
  IF appName = 'sap/system'.
  runtime->keep_context = 1.
  ENDIF.
  param = '?'.
  request->get_form_fields( changing fields = ffs ).
  DELETE ffs WHERE name cs '~'.
  LOOP AT ffs INTO ff.
  CONCATENATE param ff-name '=' ff-value '&' INTO param.
  ENDLOOP.
  CONCATENATE target_page param INTO target_page.
%>
<html>
 <head>
 <script language="JavaScript">
 var out
<%
  DATA: guid TYPE GUID_32. CALL FUNCTION 'GUID_CREATE' IMPORTING ev_guid_32 = guid.
%>
function exitBSPApplication(newTargetUrl) {
<%
  IF runtime->session_manager->is_running = 0. CLASS cl_bsp_login_application DEFINITION LOAD.
%>
var url = "<%= CL_BSP_LOGIN_APPLICATION=>GET_SESSIONEXIT_URL( page = page ) %>";
<%
  IF do_not_delete_sso2_cookie
  IS NOT INITIAL.
%>
url += "&bsp_do_not_delete_sso2_cookie=X";
<%
  ENDIF.
%>
 var prop = 'height=100,width=400,top='+(screen.height-100)/2+',left='+(screen.width-400)/2; if(document.all) { out = window.open(url,'_blank',prop); } else {
ver=window.navigator.vendorSub; if(ver==7.00 || ver==7.01 || ver==7.02) { out.document.location.href=url; } else { out = window.open(url,'_blank',prop); } }
<%
  ENDIF.
%>
}
function loader() { if(document.all) { return; } else { ver=window.navigator.vendorSub; if(ver==7.00 || ver==7.01 || ver==7.02) {
<%
  IF runtime->session_manager->is_running = 0.
%>
 prop = 'height=100,width=400,top='+(screen.height-100)/2+',left='+
(screen.width-400)/2; out = window.open('default.htm','_blank',prop);
<%
  ENDIF.
%>
 window.focus();} }
}
</script> </head>
<body onload="loader();" scroll="no" bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0" onUnLoad="exitBSPApplication();" >
<iframe id="fr0" frameborder=no height=100% width=100% name="<%= guid %>_A" src="<%= target_page %>"> </iframe>
</body>
</html>

Its the same code you´ve provided in SDN!

main.htm looks like this:

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title="Anmeldeseite mit Auswahl zu Links " >
    <htmlb:form>
      <htmlb:textView text   = "Hello World!"
                      design = "EMPHASIZED"></htmlb:textView>
      <htmlb:button id      = "logout"
                    text    = "Log Off"
                    onClick = ?????></htmlb:button>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

As you can see, default.htm redirects to main.htm and you see a button with logout as its id. No I need a functionality for the onClick action, so that I will get back to my Logon screen. This implies, that the session will also get deleted!

I hope that I could explained my problem in more detail now.

Thank you for you patience!

With best regards,

Mehmet

eddy_declercq
Active Contributor
0 Kudos

Hi,

I you case I would do

<htmlb:button id = "logout"

text = "Log Off"

onClientClick = "document.URL = 'default.htm';" />

The only problem here is that you can't specify a target.

I would just put an ordinary link.

Eddy

Former Member
0 Kudos

Hi Eddy,

I will try you suggestion and give you some feedback!

Best regards,

Mehmet

Former Member
0 Kudos

Hello Eddy,

I tried it but the Logon Screen does not appear?!

I still stay in the same page. What could be the problem?

Maybe the sessioncookie is still active so I get logged on automatically?

Thank you and with best regards!

Mehmet

eddy_declercq
Active Contributor
0 Kudos

Hi,

A plain link with target = '_top' going to you entry point should work. It works at our site.

Eddy

Former Member
0 Kudos

Hello Eddy,

Ok now I´ve used "target=_top". And I get a message that my user session will be terminated, but the logon screen does not appear

Thank you for your help.

I will reward you with forum points.

Mehmet

eddy_declercq
Active Contributor
0 Kudos

Hi,

Maybe Thomas' suggestion mentioned in

can help.

Eddy

athavanraja
Active Contributor
0 Kudos

try this

<% data: temp_url type string .

concatenate <currentpageurl> '&sap-sessioncmd=close&sap-exiturl=' 'default.htm' into temp_url . %>

<htmlb:button id = "logout"

text = "Log Off"

onClientClick = "javascript:window.open ('<%= temp_url %>', '_top' />

Regards

Raja

Former Member
0 Kudos

Hello Durairaj,

THANK YOU VERY MUCH!

Former Member
0 Kudos

hi mehmet,

can u send me the working code for all 3 pages of this BSP Application and also send me the Navigation and Properties settings for this BSP Application...I have received the same Requirement..and i m working on BSP Application for the first time.

Answers (2)

Answers (2)

Former Member
0 Kudos

Good evening Durairaj,

I am also  having same issue..I am created log on screen using TCode SICF->Error Pages-> System logon.

If user Click  log off  button after ending the  session that should redirect to Logon screen which is created by using SICF.

Your code  showing error in my page..

where i should use that code...Please Suggest me...

Thanks & regards

santhosh

eddy_declercq
Active Contributor
0 Kudos

Hi,

Pls check web logs like

/people/eddy.declercq/blog/2005/11/15/enemy-of-the-state

Eddy