cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding getting the portal Login ID?

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();

IUser user = clientUser.getSAPUser();

Regards,

Deepak

Former Member
0 Kudos

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-bdc3ff8c...

there are some thread releated to it.

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

Former Member
0 Kudos

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