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

retrieve portal user

Hi,

can somebody help me. I want at starting of a WD application. That it retreives the portal user as in input of the bapi. Is there a tutorial or can somebody explain me what code i need to use or ahat i need to do

Regards

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 01, 2006 at 10:35 AM

    Hi,

    use the follwowing code,

    String loginUser="";

    IWDClientUser wdUser = WDClientUser.getCurrentUser();

    IUser user = wdUser.getSAPUser();

    if(user != null)

    {

    IUserAccount acct[] = user.getUserAccounts();

    if(acct[0] != null)

    {

    loginUser = acct[0].getLogonUid();

    }

    }

    add the follwing import statements,

    import com.sap.security.api.IUser;

    import com.sap.security.api.IUserAccount;

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Let's say that you are doing the username retrieval part in the custom controller. So create a value attribute say, UserName in the custom controller's context. Also create a value attribute of the same name in the view controller's context under the value node that is boind to the datasource property of the table and map the custom controller attribute to the view controller's attribute. The view context might look like:

      -Root

      --TableDataNode

      ---UserName

      ---... (other nodes)

      ---...

      ....

      Once you have fetched the user name in the custom controller, use a code like:

      wdContext.currentContextElement().setUserName(userNameStr);
      

      Now in your view, create a table column to show the user name. Insert a textview as the cell editor and bind the

      text property to, TableData.UserName.

      Regards,

      Satyajit.

  • Posted on Sep 01, 2006 at 09:57 AM

    Hi,

    To Retrive Loged-In user from Portal use below Code.

    IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();
    String user = "";
    if (clientUser != null) {
      IUser iUser = clientUser.getSAPUser();
      if (iUser != null) {
      try {
       IUserAccount[] acct = iUser.getUserAccounts();
       if (acct[0] != null) {
        user = acct[0].getLogonUid();
       }
    }catch (UMException umex) {
    }
    }
    }
    return user;
    

    Regards,

    Sridhar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 01, 2006 at 10:05 AM

    Hi,

    Check this

    display-user-id-of-portal

    Regards,

    Vijayakhanna Raman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 01, 2006 at 10:35 AM

    Hi,

    Have a look at this thread

    getting-portal-user's-role

    Regards,

    Saravanan K

    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.