cancel
Showing results for 
Search instead for 
Did you mean: 

How to Get Email ID of the User Logged in SAP Portal

Former Member
0 Kudos

HI all,

I need the Webdynpro Java Code to get the Email Id of the User Logged in the Portal. The Email Id is in the Personal Information of the User Log on Id. Kindly help me to get the Email Id of the User Logged in or send me any relavent links for that.

Accepted Solutions (0)

Answers (4)

Answers (4)

marcel_frei
Participant
0 Kudos

Hi Karthik,

It is good to know how you can access the User Management Engine (UME) like poster before me have pointed out. But what you want to do is much easier to achieve.

With the following line of code you get the currently logged in user in WebDynpro:

IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();

IWDClient user gives you the logon id (getClientUserID()), the firstname, lastname, title, locale , timezone and salutation but not the e-mail address.

To get the e-mail address you have to call the IWDClientUser's getSAPUser which will give you an IUser object. IUser gives you a lot more information.

To get the e-mail address you could do something like this:


IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();
	  if(clientUser != null) {
		  IUser user = clientUser.getSAPUser();
		  if(user != null) {
			  String eMailAddress = user.getEmail();
		  }
	  }

Former Member
0 Kudos

Hi,

For getting the email ID you can write a java code using the Iuser Interface. Have look to the following:

public class UseremailID extends AbstractPortalComponent

{

public void doContent(

IPortalComponentRequest request,

IPortalComponentResponse response)

{

try

{

IUserFactory userfactory = UMFactory.getUserFactory();

IUserSearchFilter userfltr = userfactory.getUserSearchFilter();

userfltr.setMaxSearchResultSize(5000);

ISearchResult userResult = userfactory.searchUsers(userfltr);

while (userResult.hasNext())

{

response.write("<table border=0>\n");

String uniqueid = (String) userResult.next();

IUser user = userfactory.getUser(uniqueid);

//IRole role = rolefactory.getRole(uniqueid);

response.write("<tr><td bgcolor=Red>"+ user.getDisplayName()+ "</td></tr>\n");

response.write("<tr><td bgcolor=Green>"+ user.getEmail()+ "</td></tr>\n");

response.write("</table>\n");

response.write("

\n");

}

}

catch (Exception e)

{

}

}

}

for analyzing the error you just need to check the log file at your server. Visit the following path:

<Your_SAP_Drive> :/usr/sap/<your_System_Name>/jc00/j2ee/cluster/server0/log/

There you can view the .trc file. Open that file and look for the error or the Stack trace in that.

i think it may help you

Former Member
0 Kudos

Hi,

Using UME API you get Email id of the logged user



IUser Current_User = UF.getUser(UID); //UID  -->Unique ID of the user
Current_User.getEmail();  // UF -->IUserFactory 

Regards

Manivannan P

vijay_kumar49
Active Contributor
0 Kudos

Hi,

Please read this [Document|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars/technology-rig-know-how/presentations/using%20the%20user%20management%20api%20with%20ep%20applications%20-%20webinar%20powerpoint.pdf] This is help full for you.

Regards

Vijay K