cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynpro Application to get Portal User

Former Member
0 Kudos

Hi all,

I have developed a WebDynpro Application for SAP Portal 6.0 SP12. I want to read the user ID of the currently logged in Portal User in my WebDynpro Application to show personalized data. In the WebDynpro I use the following code:

try

{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

if(user != null)

{

IUserAccount acct = user.getUserAccounts()[0];

nameSpace = user.getAttributeNamespaces();

CustomerNo= user.getAttribute("com.sap.security.core.usermanagement","CustomerNo");

SalesOrganization = user.getAttribute("com.sap.security.core.usermanagement","SalesOrganization");

}

}

catch (Exception e)

{

msgr.raiseException(" Not a Valid Customer : "+e.getMessage(),false);

}

The IUser user is always Null.

Portal and the J2EE engine are running on the same system.

I tried to switch on authentication in the properties of the application.

The result was that I get a second login screen when I call the IView with my WebDynpro in it.

When I enter my Portal credentials, nothing happens, login screen comes again. Giving wrong credentials results in a bad login error as expected.

Is there another way to get the User data?

Can somebody tell me how should i go ahead ?

thanx and regards,

anuradha.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Maksim,

I tried enabling "authentication" in webdynpro application but by doing this i am getting a login screen.How do i pass the parameters without getting the login screen?

thanx and regards,

anuradha.

former_member182372
Active Contributor
0 Kudos

Hello anuradha,

As I said you need to configure authorization for dynpro system on portal using SSO or user mapping.

Check documents:

http://help.sap.com/saphelp_nw04/helpdata/en/89/6eb8deaf2f11d5993700508b6b8b11/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/e5/4344b6d24a05408ca4faa94554e851/frameset.htm

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi,

How do i get th IUser in my application? I have tried to import but still it says not available. Do i need to include any files? Please let me know.

Regards,

Aditya.

Former Member
0 Kudos

Hi Aditya,

To get the IUser class you need to add security.api jar file in your project's build path. For that, in the WebDynpro explorer view of your NWDS, navigate to Your_project->properties->Java Build path->Libraries->Add variable->Click on Eclipse Home->extend->plugins->com.sap.security->lib->com.sap.security.api.jar.

Now IUser will be avaialble for you.

Best Regards,

Nibu.

former_member182372
Active Contributor
0 Kudos

Hello anuradha,

If "authentication" property for webdynpro application is turned off IUser is null in this case because it is anonymous access. So, you have to turn this property on and setup authentication on portal for dynpro system using ticket or user mapping.

Best regards, Maksim Rashchynski.