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!
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member193460
Contributor

Implement Logout button on Webdynpro Application - Step by
Step

i have seen lot of contents regarding logout functionality
for Webdynpro applications, but unfortunately most did not work (incomplete
steps). So, i thought it's important to share what i have done to achieve the
logout functionality for my application. This document is created under the
assumption that you already have a Webdynpro component with an application
which requires the logout functionality.

Pre-requisite:

1) Familiar with Webdynpro ABAP concepts.

2) Familiar with Webdynpro ICF Settings

Solution overview:

The solution can be divided into two parts:

Part 1:  creation
of exit plug and minimum ABAP required to fire the exit plug.

Part 2: Integration of java script code in the ICF
application node to clear cookies.

Part 1: Everything you need to do inside your webdynpro component

Create EXIT plug for the window.


   Declare the use of window controller in your view.

In the properties tab of the view, declare the usage of your
window controller.

Create the logoff button in the view of your Webdynpro
component with an onAction Event.

Method onActionLOGOFF will contain the below code.

PART 2: Settings in ICF node of your Application.

Execute tcode: SICF and enter your application name in Service
Name field, then Execute.

Enter the below Javascript code in Explicit Response page
header or body or both.

java script code

<html><body> <span id="onloadscript"><NO_TRANSLATION> <!-- 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:59GMT;"+p + "domain="+sso2Domain+";"; }; try{document.execCommand( 'ClearAuthenticationCache' );} catch (e) {}DelSso2Cookie("MYSAPSSO2","/");--> </NO_TRANSLATION><span style="font-weight:bold;vertical-align:middle"><h2>


Logged out successfully ! Please login again to resume

</h2></span></span><NO_TRANSLATION><img src="/sap/public/bc/ur/nw5/1x1.gif" onload="var onloadscript = document.getElementById('onloadscript'); var scriptText = onloadscript.childNodes[0].nodeValue; eval(scriptText);"> </NO_TRANSLATION><h1>


logged out successfully

</h1></body></html>

This java script code will clear the cookies and will
enforce the user to enter the credentials again.

The logon procedure of the service node should only have
" Logon Through HTTP Fields" in the logon procedure as below.

PS modification(Document amended):


Please add "SSO authentication " or "SAP logon ticket" as second step in the Alternate logon procedure.
If the system has https port enabled, then the default standard logon procedure will work for the logoff functionality.


The steps are complete now.. Go ahead and test the logout funcationality.

Click logout and the EXIT plug will clear the cookies, thus enforcing the user to reenter the credentials.

Note: The above example is solely based on the requirement i had for my project, so if incase there are any other way of doing this, please comment.

34 Comments
Labels in this area