cancel
Showing results for 
Search instead for 
Did you mean: 

How to display currently logged in user details ?

Former Member
0 Kudos

Hi all,

I have a specific requirement to develope using Webdynpro. I want to programically display the list of users currently logged-in . Could some one help me . I promise to award points for the solution.

Thank you in advance

Regards

Maruti

Accepted Solutions (0)

Answers (2)

Answers (2)

saraswathi_d
Participant
0 Kudos

Hi,

This procedure is for currently logged in user access.

You should add security.api.jar for UMFactory

Right click on your project name--->java buildpath ? Libraries>Add Variables --> Eclips home >Extend>Plugin-->com.sap.security_2.00 --> lib --> com.sap.security.api.jar .

Create Username and Email id context attributes. And Bind it with the UI elements like textview.

Write the below code in view implementation init method.

doinit method () implementation

try {

String firstName = WDClientUser.getCurrentUser().getFirstName();

String lastName = WDClientUser.getCurrentUser().getLastName();

String name = firstName + " " + lastName;

wdContext.currentContextElement().setUser(name);

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

IUser iuser = null;

while (rst.hasNext()) {

iuser =

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

if ((firstName.equalsIgnoreCase(iuser.getFirstName())) & (lastName.equalsIgnoreCase(iuser.getLastName()))) {

String emailId = iuser.getEmail();

wdContext.currentContextElement().setMailID(emailId);

}

}

} catch (WDUMException e) {

e.printStackTrace();

} catch (UMException ue) {

ue.printStackTrace();

}

Regards,

Saraswathi.

Pls reward points for useful information

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Maruti,

You need to add something called com.sap.security.api.jar file to the library of your project(It will be in SAP\JDT\eclipse\plugins folder). when you want access the UME APIs.

See this thread

/thread/99462 [original link is broken]

/thread/198332 [original link is broken]

Regards, Suresh KB