cancel
Showing results for 
Search instead for 
Did you mean: 

login user

Former Member
0 Kudos

i need to catch the user name and validate them who were login to application .

what is procedure in webdynpro application.

and what are the steps.

Accepted Solutions (1)

Accepted Solutions (1)

former_member189631
Active Contributor
0 Kudos

Jagan,

The code is here,

try {

IUser user = WDClientUser.getCurrentUser().getSAPUser();

String Name = user.getDisplayName();

} catch (WDUMException ex) {

}

Similar way you can get the user porperties.

Ramganesan Karuppaiyah

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

To validate the login user, get the login user details, and check the permissions.

this [guide|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1c693fcf-0201-0010-d9bb-f48b1d8c9706] help you.

Regards,

Naga

Former Member
0 Kudos

HI

I am sorry i gave a wrong code before as i didnt read question correctly sorry for that.Try this code it may help to some extent

{

// get the currently logged in user

IWDClientUser wdUser = WDClientUser.getCurrentUser();

//get the com.sap.security.api.Iuser; It is null in case wdUser represents an anonymous user

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.currentNode().setAttribute(new String(strUserid));

}

}

}

Note: Defining the IUser will show an error. To resolve this:

Right-click the project in SAP NetWeaver Developer Studio.

Select Properties.

Choose Java build path -> Libraries -> Add Variable -> Select variable WD_RUNTIME -> Extend -> com.sap.security -> lib -> com.sap.security.api.jar.

Open this file and retype the code.

Thanks,

Tulasi

Edited by: Tulasi Palnati on Jul 24, 2008 7:12 AM

Former Member
0 Kudos

Hi,

you can use the below code to get login user.

IWDClientUser user = WDClientUser.getCurrentUser();

userid = user.getSAPUser().getUniqueName();

Thanks,

Ramesh

Former Member
0 Kudos

Hi,

U can get the user id of the logged in user:

int beginindex=WDClientUser.getCurrentUser().getSAPUser().getUniqueID().lastIndexOf(".")+1;

Regards,

Padmalatha.K