cancel
Showing results for 
Search instead for 
Did you mean: 

How to catch URL parameter from Portal URL in Web Dynpro iView

Former Member
0 Kudos

Hi All,

I have a web dynpro application running as a portal iView successfully. Now the client wants to make it internationalized with 7 languages. Currently they access the portal - and via role assignment they get to the portal tab with the wd iView. Now they want to send a parameter for the language key with the portal URL. So when they are typing in http://myportal.mydomain.com now they want to type in http://myportal.mydomain.com?sap-locale=de or so. My question is how can I catch this parameter in the WD application when it is running inside a portal iView? Is it at all possible?

I have written a very small application which is trying to catch a URL parameter named PARAM. The code I have written is the default one as below:

String paramValue = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PARAM");

When I run the application standalone and add the PARAM=something in last of the URL I can catch it. But when I create an iView and while previewing it I add the same PARAM value it is coming as null all the time. Same when I add this iView to a role and show it via role assignment in protal. Please help to let me know how to achieve this. I think if I can read the parameter value from Portal URL in the WD iView - then I can set it as the default locale of the application and then show language specific file to achieve internationalization.

Your urgent help will be highly appreciated.

Warm Regards,

Shubho

Accepted Solutions (0)

Answers (5)

Answers (5)

vikas_saxena3
Participant
0 Kudos

Hi Shubho,

I have similar problem in my WD appln..

Could you please let me know.. how have you solved this problem..?

Thanks in advance!!!!

Regards,

Vikas

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Shubhadip,

Portal iview:

Goto iview show all properties set the value:

Parameters to Pass from Page Request (for URL Is...) set: PARAM or *

Using donavigate you can navigate to the webdynpro iview.

EPCM.doNavigate("ROLES://portal_content/webdynproPCDlocation&DynamicParameter=PARAM=en");

Give path of webdynpro iview PCD location

Webdynpro iview:

Goto iview Show all properties and Set the following for

Application parameters : PARAM = value

WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PARAM");

Regards, Suresh KB

Former Member
0 Kudos

Hi Shubhadip

Even if you get the parameters, how do you internationalize your application? Are you not following the standard way as described in the following link. In this case you never need to capture any such parameter. This is done by the WD runtime automatically .

<a href="http://help.sap.com/saphelp_erp2005/helpdata/en/f4/d95664da179b4db731e21c2e470b72/frameset.htm">Internationalization of WD projects</a>

You can retrieve application parameters specified at the creation of iview by "adding parameters(with the same name as in iview application parameters) to the default plug of the Component Interface View of the WD application". "onDefaultPlug" method of the interface view controller you get these values as parameters, which you can save in the context node of component controller for later use.This is guaranteed to work.

But again this is not what you want exactly. You want the user to specify the value at runtime. If you have just 7 languages, you can create 7 set of iviews with different application parameter value indicating language key, and assign to 7 different set of roles, each representing one set of users with common language.

I hope you find a solution.

Regards

kk

Former Member
0 Kudos

Hi Shubhadip,

I have a similar situation to yours. I set the parameter in the "application paratemers" field of the iView. Something like param=a. In the Java code I use the following:

IWDRequest req = WDProtocolAdapter.getProtocolAdapter().getRequestObject();

String string = req.getParameter("param");

This works for me. Hope this helps.

Former Member
0 Kudos

Hi Eric,

in your way arent you always setting the parameter value as "a" if you provide param=a in your application parameter setting? I require user to sepcify the value in the runtime.

Regards,

Shubhadip

former_member197348
Active Contributor
0 Kudos

Hi Shubhadip,

In the iView properties, you have to set Application Parameters proprty PARAM=something. If already you are setting this property and it is not working, then you have to go with other alternative that is handling with in application.

regards,

Siva

Former Member
0 Kudos

Hi Siva,

not exactly..if you see my requirement properly - the user will provide the value of this parameter - so I cant predetermine what should be the value of that. Thus I think application parameter setting will not work here.

Regards,

Shubho

Former Member
0 Kudos

Hi,

If the parameter is totally provided by the user, how do you know what to catch? Do you have an agreed upon parameter name like "sap_locale" or something?

Also take a look at .

Regards,

Satyajit.

Message was edited by:

Satyajit Chakraborty

Former Member
0 Kudos

Hi Shubho,

If you pass the parameter like this with your iview:

?DynamicParameter=PARAM%3Dvalue

Then you can read it in WebDynpro using

WDWebContextAdapter.getWebContextAdapter().getRequestParameter("PARAM");

If you want to use this for internationalization, you should consider using the standard options for this, e.g. use the user's language, which is passed automatically to the webdynpro.

Johan

Former Member
0 Kudos

Hi,

The scope of WDWebContextAdapter is limited to webdynpro application only.

In case of it being accessed through portal, we have to use some portal services available as it would be available in a PortalComponentRequest.

For i18n, you can copy .xlf files to the specific locale and use them. For more info ,

https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/35f1e990-0201-0010-7a86-914036942779

Regards

Bharathwaj

Former Member
0 Kudos

Hi Satyajit,

the user will be providing the value of the parameter - I already know what the name of it will be. Suppose for example the parameter name is "LANGUAGE". In that case if I run my WD application in stand alone mode I can catch its value - but when I preview the WD iView inside portal and add ?LANGUAGE=EN - I get null all the time.

Regards,

Shubho

Former Member
0 Kudos

Hi Johan,

I tried your method. Its working when I am previewing the iView. But when I am running it via a role in portal - i.e. adding the iView in a role and assign the role to me - then its not working. Its still taking null. It seems portal is rewriting the URL sometwhere in between and this parameter value is getting lost.

Regards,

Shubho

angel_dichev
Active Participant
0 Kudos

Hi,

See chapter 7.9 from Chris's WDforJava book

http://searchsap.techtarget.com/searchSAP/downloads/SAPPRESS.pdf

Regards, Angel