Skip to Content
author's profile photo Former Member
Former Member

Getting current username

Hi,

How can i get username currently log in portal?

Thanks.

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 22, 2009 at 02:52 PM

    Hello

    Use the following piece of code to get the logged in user name

    try 
    {
        IWDClientUser clientUser = WDClientUser.getCurrentUser()
    } 
    catch (WDUMException e)
    {
        // do exception handling
    }
    

    Do try searching the forum before posting questions, this question has been asked and answered way too many times.

    Thanks,

    GLM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Cemil Bozlagan,

      	String userName = "";
      		
      		try
      		{
      			IUser user= WDClientUser.getCurrentUser().getSAPUser();
      		}
      		catch (WDUMException e)
      		{
      			wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), false);
      		}
      		
      		userName = user.getUniqueName();
      // we have different  methods here like getDisplayName(), getUniqueID() etc.

      Regards,

      Siva

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 05:55 AM

    Hi Cemil Bozlagan,

    Use the code to get current user logged in

    try

    {

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

    String name=user.getUniqueName();

    }

    catch (WDUMException e)

    {

    }

    U need to add com.sap.security.api.jar file to the project.

    Regards,

    srikanth

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 05:45 AM

    Try the following code to get vurrently logged in user on portal :

    IWDClientUser l_ClntUser = WDClientUser.getCurrentUser();

    IUser l_IUser = l_ClntUser.getSAPUser();

    IUserAccount[] l_IUA = l_IUser.getUserAccounts();

    String uniqName = l_IUA[0].getLogonUid();

    If the logged-in user is a URL parameter then try the following :

    Eg: to extract the parameter "User" from the URL

    String LogginUser = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("User");

    Also check this thread...

    How to get User Id in Web dynpro application

    Thanks

    Avik

    Edited by: AVIK SANYAL on Aug 24, 2009 6:49 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 24, 2009 at 06:04 AM

    Hi,

    Use this code,

    IWDClientUser wdUser = WDClientUser.getCurrentUser();

    IUser user = wdUser.getSAPUser();

    Note: Defining the IUser will show an error. To resolve this, within the properties of

    the project, choose Java build path -> Libraries -> Add external jars ->

    com.sap.securities -> lib -> com.sap.security.api.

    Regards,

    Sunaina Reddy T

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.