cancel
Showing results for 
Search instead for 
Did you mean: 

portal user details

Former Member
0 Kudos

HI

I need to develop a web dynpro application which gives the details of the portal user details who logs into portal

Can anyone provide me the code how to fetch the details of the users who logs into portal

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

siddharth_jain
Active Contributor
0 Kudos

Hi,

Make sure that your WebDynpro Applications Authentication property is set to True.

To get Portal User Details you can use the following UME Api's

try

{

IWDClientUser user = WDClientUser.getLoggedInClientUser();

IUser loggedInUser = user.getSAPUser();

}

catch(UMException ume)

{

//do something

}

this Iuser objects holds all the Properties of Portal User Except its Password.

and You can retrieve it like this

loggedInUser.getFullName();

if you know the Logon id of Portal User you can Also get the IUser object like this:--

IUser user = UMFactory.getUserByLogonId("Administrator");

To use UME APIS in Webdynpro you have to refer com.sap.security.api.jar in the Build path of your WebDynpro Application.

If You Are Using NWDI then you have to use the com.sap.security.api.sda lib Dc available in NWDI for Compilation in WD DC

Hope this Help.

Regards,

Siddharth

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can use followng code inside Init() method of the view in which you want to access the portal user....

//Code for getting group of loged-in user

String struserName = null;

try

{

IWDClientUser user = WDClientUser.getCurrentUser();

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

struserName = currentUser.getName();

wdContext.currentContextElement().setCtx_Va_LoginId(struserName.toUpperCase());

}

catch (Exception e) {

wdComponentAPI.getMessageManager().reportException(e.getMessage(), false);

}

// Code for getting group of loged-in user

Here for IWDClientUser ,you will have to add api com.security.api.sda

Hope this ill help you.

Thanks,

Prajakta

Former Member
0 Kudos

Hi,

You can get the current logged in user with following code

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

user.getUniqueName();

user.getCity();

You can all other information with user object.

Thanks