cancel
Showing results for 
Search instead for 
Did you mean: 

help needed

former_member1193316
Participant
0 Kudos

Hi,

How to read the first name(userid) who currently logged in portalu2026

here my requirement is I m having an iview which displays the user name who currently logged in portal. How to do that.

Another requirement is in iview I want a link. When I click on that link it should navigate to another role. How to call that role when I click on the link

Regards

Venkat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Can you try with the below code to get the looged in user id

try

{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

if (user != null)

{

IUserAccount[] acct = user.getUserAccounts();

if(acct[0] != null)

{

epUser = epUser+acct[0].getLogonUid();

String test=acct[0].getUniqueID();

}

}

else

{

wdComponentAPI.getMessageManager().reportSuccess("USER NULL");

}

}

catch(Exception e)

{

}

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Venkat,

chk this:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/905cb568-ce15-2a10-0199-af0099da322e]

[;

this thread shud b hlpful to u..

Regards,

Khushboo

Former Member
0 Kudos

Hi,

Try this link...

Getting Logged in Portal User Details in Web DynPro

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/getting%2blogged%2bin%2bportal%2buser%2b...

/thread/366457 [original link is broken]

Thanks.

Abhilasha

Edited by: Abhilasha Dahare on Aug 26, 2008 1:17 PM

Former Member
0 Kudos

hi,

u can get the user name using the below code,

String userid="";

try {

IWDClientUser user = WDClientUser.getCurrentUser();

userid = user.getSAPUser().getUniqueName();

} catch (WDUMException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

Thanks,

ramesh

Former Member
0 Kudos

hi Ramesh,

I have used the same code what ever u have given but am getting null pointwer exception..I have tried even with first name and last name also but still am getting null pointer exception only..can u please help me regarding this.

Thanks in advance,

Anusha

Former Member
0 Kudos

Hi Anusha,

please post the stack trace of the error..

Former Member
0 Kudos

hi Ramesh,

I am getting below exception:

The initial exception that caused the request to fail, was:

java.lang.NullPointerException

at com.portalrolesapp.View2.wdDoInit(View2.java:126)

at com.portalrolesapp.wdp.InternalView2.wdDoInit(InternalView2.java:122)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)

Former Member
0 Kudos

Hi,

In addition to code mentioned you will need to add one external jars in the build path of your project. You can do this by right clicking on your Project Name ==> Properties ==> Java Build path ==> Add variables ==> WD_Runtime--- and Extend.

The jar name is:-

1)com.sap.security_2.0.0

Thanks,

ramesh

Edited by: Ramesh Babu V on Aug 26, 2008 6:02 PM

Former Member
0 Kudos

hi ramesh,

I have added com.sap.security.api.jar

com.sap.security.perm.jar

But still am getting the same null pointer exception

Former Member
0 Kudos

Hi,

Double click on your application properties>Application properties>Predefined-->select Authentication and then set the value to true. Re-deploy and execute your application.

Regards,

Murtuza

Former Member
0 Kudos

please provide the source code you have written, as following code is running fine at my end.


	String uname = null;
	try 
	{
	   	IWDClientUser cUser = WDClientUser.getCurrentUser();
   		IUser user = cUser.getSAPUser();  		 
		
		uname = user.getUniqueName();
	}
	catch (Exception ex) {
		ex.printStackTrace();
	}

Regards,

Jawed Ali

Former Member
0 Kudos

Hi

IWDClientUser clientUser;

clientUser = WDClientUser.getCurrentUser();

IUser user = clientUser.getSAPUser();

user.getLatName();