cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Login Id (UPI) of the user who logged in the system?

Former Member
0 Kudos

hi,

I'm having a webdynpro application. In which i want to get the values from the R/3 based on the user who logs in.

so i need to get the UPI(login id) of the user who logs in. how to get the UPI of the user who logged in??

please help me out with the detailed procedure.

Thanks & Regards,

Suresh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Suresh,

Try the following code.

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();

}

I have already used this code for the similar requirement.

regards

Anil

Former Member
0 Kudos

Hi Suresh,

See whether following will help you or not?:

	try {
		wdComponentAPI.getMessageManager().reportSuccess(WDClientUser.getCurrentUser().getSAPUser().getUniqueName());
	} catch (WDUMException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}	

Regards,

Gopal

Former Member
0 Kudos

Thanks Gopal,

its getting the logged user.

but id which i'm getting has two characters in it. that is "CS45567".. here i have to remove those two characters "CS" and pass only the numerals to the RFC..

How to truncate those values.. please help me out with detailed code..

Thanks & Regards,

Suresh

Former Member
0 Kudos

Hi Suresh,

That is simple java code. You can try following:

	try {
		String user = WDClientUser.getCurrentUser().getSAPUser().getUniqueName();
		String userId = user.substring(2);
		wdComponentAPI.getMessageManager().reportSuccess(userId);
	} catch (WDUMException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

This will work only when you are sure that you want to truncate first 2 characters.

Regards,

Gopal