cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve user in webdynpro code through ume api

Former Member
0 Kudos

Hi

How to get the user name through code in webdynpro application.

please tell me which UME api to use.

Regards

Vidyadhar

Accepted Solutions (0)

Answers (6)

Answers (6)

vmadhuvarshi_
Contributor
0 Kudos

Vidyadhar,

Take a look at [this article|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e039ce31-4156-2b10-1481-bdc3ff8cae48]. This should be helpful. basically, you'll need a combination of these code lines to get what you want.


                IWDClientUser clientUser = WDClientUser.getCurrentUser();
		  IUser user = clientUser.getSAPUser();
		  String displayname = user.getDisplayName();
		  String uniquename = user.getUniqueName();
		  String firstname= user.getFirstName();
		  String uid= user.getUniqueID();
		  String jobtitle= user.getJobTitle();
		  String lastname=user.getLastName();

Besides these properties, there are a lot more properties available with IUser class, which would be useful to you.

Hope this helps.

Vishwas.

Former Member
0 Kudos

Use this line of code to retrive the portal user id:


WDClientUser.getCurrentUser().getSAPUser().getUserAccounts()[0].getLogonUid().toUpperCase()

Add these 2 jar files to buildpath:

1)com.sap.security.api.jar

2)com.sap.security.api.perm.jar

For more help how to add jars :

If it's not a local project and if you use NWDI environment , here the blog how to add jars for Web Dynpro DC's.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/194bdc4f-0901-0010-82ba-bf7...

Thanks

Krishna

Former Member
0 Kudos
Former Member
0 Kudos

Hi,

Check the code below, you can retrive the user details

ISearchResult rst = UMFactory.getUserFactory().getUniqueIDs();

IUserFactory usf = UMFactory.getUserFactory();

IUser iuser = null;

IUserListElement userElement = null;

int i = 0;

while (rst.hasNext()) {

iuser =

UMFactory.getUserFactory().getUser(rst.next().toString());

String email = iuser.getEmail();

String fname = iuser.getFirstName();

String lname = iuser.getLastName();

}

let me know if there are any issues.

regards

Anil

Former Member
0 Kudos

Hi,

use this,

String userid="";

try {

IWDClientUser user = WDClientUser.getCurrentUser();

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

} catch (WDUMException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Regards,

ramesh

Former Member
0 Kudos

Hi,

This code will retrieve the details,

IUserFactory factory = UMFactory.getUserFactory();

IUser user = factory.getUserByLogonID(userId);

lastName = user.getLastName();

firstName = user.getFirstName();

Regards,

Srinivasan Subbiah