cancel
Showing results for 
Search instead for 
Did you mean: 

how to find current user name in web dynpro application

Former Member
0 Kudos

Hi,

Like we have sy-uname in ABAP for getting the current user,

could you please tell me what is the method name for getting the current user ID in web dynpro coding ?

Could you please tell me standard documentation which can be refered to find method names etc for any operation required to be done ?

thanks

Accepted Solutions (1)

Accepted Solutions (1)

bhakti2
Active Participant
0 Kudos

hi,

Could you please tell me how to add the security.api jar file to my project

when i do add extrenal jar file, it opens up C:/programfiles/java/jre1.4.2_12 where i am not able to find any security.jar file

thanks

r

former_member192434
Active Contributor
0 Kudos

Hi Rita,

Right clik on ur project>>property>java build path>Add Veriables->WD Runtime>click Extend>com.sap.securtiy_2.0_0.jar file.-->click extend ->select> Clikc ok ..

then rebuild ur project.

If Ans is help full plz award points

Thanks

Edited by: Anup Bharti on Nov 10, 2008 5:31 AM

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi ,

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

Former Member
0 Kudos

Hi,

refer this thread

Regards,

ramesh

former_member192434
Active Contributor
0 Kudos

Hi Rita,

Use this code,

PS: Before using this code add security_2.0.jar file into ur Java build path.

//@@begin CheckAllUsersLogin()

IWDClientUser currentUsers[]=WDClientUser.getClientUsers();

loggedOnUserID = WDClientUser.getCurrentUser().getClientUserID();

//Displaying the count of logged on users

wdComponentAPI.getMessageManager().reportSuccess("Number of logged on Users in the portal - "+(currentUsers.length-1));

for(int i=0;i<currentUsers.length;i++){

if(currentUsers<i>!=null){

// Displaying the logged on users;

if(!currentUsers<i>.getLastName().equals("Guest")){

String first= currentUsers<i>.getFirstName();

wdComponentAPI.getMessageManager().reportSuccess("User - "currentUsers<i>.getFirstName()" "+currentUsers<i>.getLastName());

}

}

}

Thanks

pravesh_verma
Active Contributor
0 Kudos

Hi Rita,

There are few API's which give the complete user management information for the current logged in user. However if you just want to get the logged on user ID then you can use the following API.

Please read the following code.

String loggedOnUserID = null;
				try {
					loggedOnUserID = WDClientUser.getCurrentUser().getClientUserID();
				} catch (Exception e2) {
					// TODO Auto-generated catch block
					e2.printStackTrace();

				}

Apart from this you can get all the details of the user through user management API's.

If you need any further information please let me know.

Thanks and Regards

Pravesh