Skip to Content
avatar image
Former Member

Regarding getting the portal Login ID?

Dear All,

i need to get login userid of the portal,into my WDA Application.

How can i get that? Could you plz tell me steps to follow..........

i gone thruogh some related threads,i didnt get clearly........

if any code available ,it is very helpful ....

Regards,

Ravi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 05, 2008 at 05:25 AM

    Hi Bhargava,

    Following code will be of use for you

    IWDClientUser userDetails;

    try {

    userDetails = WDClientUser.getCurrentUser();

    } catch (WDUMException e) {

    // TODO Auto-generated catch block

    e.printStackTrace();

    }

    Clear Procedure for Getting all Details

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

    }

    With Regards,

    Roop Kumar.

    Edited by: Roop kumar Annavarapu on Sep 5, 2008 10:55 AM

    Edited by: Roop kumar Annavarapu on Sep 5, 2008 10:57 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 05, 2008 at 05:31 AM

    hi

    refer this link

    Fetching User Details from the Portal and Displaying it in Web Dynpro with Authentication in the Portal

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e039ce31-4156-2b10-1481-bdc3ff8cae48

    there are some thread releated to it.

    Populate data in dropdown

    Edited by: Abhilasha Dahare on Sep 5, 2008 7:39 AM

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 05, 2008 at 05:33 AM

    Hi,

    IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();

    IUser user = clientUser.getSAPUser();

    Regards,

    Deepak

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 05, 2008 at 05:42 AM

    Hi,

    add com.security.api.jar

    com.ssap.security.api.perm.jar

    activation.jar

    u can add this code on action for fetching login id frm portal

    String struserName = null;
    
    
    		//IUser user = WDClientUser.getCurrentUser().getSAPUser();
    		IWDClientUser user = WDClientUser.getCurrentUser();
    		IUser currentUser = WDClientUser.getCurrentUser().getSAPUser();
    		struserName = currentUser.getName();
    	wdContext.currentContextElement().setLoginID(struserName.toUpperCase()); 

    Here LoginID is ur context name in WD view..

    set authentication porperty as true before deplying application

    Regards,

    Khushboo

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      String loggedUserName = null;

      IWDClientUser clientUser = WDClientUser.forceLoggedInClientUser();

      IUser user = clientUser.getSAPUser();

      loggedUserName = user.getUniqueName();

      //take a context attribute loginId

      wdContext.currentContextElement().setLoginId(loggedUserName );

      Regards,

      Saleem