cancel
Showing results for 
Search instead for 
Did you mean: 

How to manage the session in the webdynpro

Former Member
0 Kudos

Hi Friends,

In My application there is a scenario like application is having user login page. when ever the user gettind login and if he is a valid user then the user name has to come to the next page which is getting displayed.

Actully i am implementing the components individually and later all are getting integarated on to the portal.

can any body give the basic idea like how can i approach .

Thanks and regards

Ratanakar reddy alwala

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

You can use the WDScopeUtil class for this purpose. The code would be like this:

//get the user name after login and before firing the plug to the next view
IWDClientUser currUsr = WDClientUser.getLoggedInClientUser();
String userName = currUsr.getFirstName() + " " + currUsr.getLastName();

//put the name in the application scope
WDScopeUtil.put(WDScopeType.APPLICATION_SCOPE, "USR_NAME", userName);

Now in the second view, you can get the name as:

String userName = WDScopeUtil.get(WDScopeType.APPLICATION_SCOPE, "USR_NAME");

Regards,

Satyajit.

snehal_kendre
Active Contributor
0 Kudos

if u know how to pass parameters from one web dynpro project to other...

then u can send the value of the "user" that u get at login screen..

just add one parameter to the default inbound plug on interface view controller of other project.. whr u want to send user name...

<u>web dynpro project whr u want values..</u>

web dynpro comp-> comp controller-> interface view-> add parameter to default inbound plug....

create a context at componant controller to store coming value...(as user name came from login screen-> it`ll set parameter of inbound plug-> u assign that parameter value to context-> then access it in ur other screens(as at screen u cant access inbounf plug directly))

make public part of comp controller as a API package.... build it

then at ur login screen project, add those public parts as used dc`s

<u>web dynpro project from whr u send values..</u>

add that public part in ur web dynpro project``s used dc`s.

in used web dynpro componant-> add ipublic part as used componant..

now u`ll get the corrsponding screen whr u want a value...

in window-> embed new view->embed interface view of componant instace

at next screen u hv to create on componant interface from used dc`s..

automaticall it`ll give u options..so ucan simply choose it.

create a outbound plug at ur screen, from whr ur sending parameters... and add that parameter in outbound plug..

open diagram view of window..whr u`ll get two view...just link the outbound plug to default inbound plug....

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi Ratnakar,

1.You can't get session object and play around in Webdynpro.

The better way i suggest you is to have an inbound plug to all your component

interfaces and pass usre name as a parameter to all.

2.

If you integrate all this in portal with single sign-on later, you can get the

username in webdynpro application using this code.

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

// check whether the user is anonymous

if (user != null) {

// access logon ID by iterating through the IUserAccount array

IUserAccount[] acct = user.getUserAccounts();

if (acct[0] != null) {

String strUserid = acct[0].getLogonUid();

// pass the value obtained from the portal to value attribute

wdContext.currentContextElement().setWelcomeText(strUserid);

}

}

Regards

Abhimanyu L

Former Member
0 Kudos

Hai,

case 1: you have login view and business view, if user valid navigate to success page , then create oubound plug with parameter username create a inbound plug to businessview with parameter navigate it.

case 2: you have two webdtnpro apps login view in Login app and business view in business App, write the exit plug with Parameter Url(send username as the url parameter to business app) . navigate to next application .(see Inter application navigation).

case 3:

If my assumption is wrong , give me the correct problem.

regards,

Naga

Message was edited by:

Naga Raju Meesala