cancel
Showing results for 
Search instead for 
Did you mean: 

Need example for using query string parameters in Web Dynpro

Former Member
0 Kudos

Hello,

Is it possible to transfer a Web DynPro application parameters at the query string (URL)?

Can someone please show me an example of how to pass it and how to retreive it using code inside an application?

Thank you in advance

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi !,

Please can you tell me what to do if you DO NOT want to destroy the source application when navigating away from it?

For example... Webdynpro App #1 calls Webdynpro App #2,

Webdynpro App #1 will always stay visible and available to the user in there toolbar in the portal. However after I click "Go" to trigger the navigation to Webdynpro App #2, then the next time I hit "Go", Webdynpro Application was destroyed out of memory I believe.

Former Member
0 Kudos

Hi,

While I'm watching for solutions for this problem I see a blog that maybe should be the solution to your problem:

<a href="/people/karsten.geiseler/blog/2005/09/29/the-customer-exit-of-the-application-integrator:///people/karsten.geiseler/blog/2005/09/29/the-customer-exit-of-the-application-integrator

I didn't try this, because I don't have this necessity anymore, hope this is help in your issue.

Good Luck

Former Member
0 Kudos

Hello Predo,

That looks interesting, the problem is this.

The weblog begings like this:

Let's start with the assumption, that you have a web application that you want to integrate with the generic component and your URLTemplate looks like this:

<System.protocol>://<System.server><System.uri>?superparam=<foo>

My URL on the other hand looks like this:

http://<server_name>/irj/portal?NavigationTarget=ROLES://portal_content/sampleQueries/DynPro/Committ...

I don't see the <System.uri> part in my URL.

More than that, it assumes that I create the iview from com.sap.appintegrator.sap" when I create it from SAP Web dynpro iview...

Message was edited by: Roy Cohen

Former Member
0 Kudos

Well, problem solved.

It appears that you need to prefix the paramjeters with "&DynamicParameter" prefix, like this:

To pass dynamic parameters with an iView link, please try the following:<PortalServer>/irj/index.html?NavigationTarget=pcd:portal_content/<

iView>&DynamicParameter=param%3Dvalue

This should pass the parameter param=value to the iView. To pass more than one parameter, you need to URL encode the '&' and '=' characters

within the DynamicParameter string, e.g.

<PortalServer>/irj/index.html?NavigationTarget=pcd:portal_content/<

iView>&DynamicParameter=param%3Dvalue%26param2%3Dvalue2

Former Member
0 Kudos

Hi,

I have exactly the same problem.

So after very topics, there are two ways to solve the question: use WDWebContextAdapter.getWebContextAdapter().

getRequestParameter("ParameterName") inside view, or get that from the interface view in the default plug (the one sugested here).

I try the both and them worked outside the portal.

The problem is that inside portal they don't work. Here this didn't get the URL parameter but what is in property iview "Application Parameters". I try to put my desired parameter in this property and he get it. But I want this parameter to be dynamic, so I have to get this from portal URL.

I'm out of ideas.

Any help will be appreciated.

Thanks

Former Member
0 Kudos

Ok, so I assume this issue needs to be directed to SAP...

Former Member
0 Kudos

Hi,

when launching WD apps in the Portal you have to define a WD iView in the Portal. This can be started using the NavigationTarget parameter.

Parameters (ie. Business Parameters) that should be passed to the WebDynpro application can be defined in the iView itself - the iView attribute is called "Application Parameters". Here you can also define variable expressions like "emailaddr=<User.email>" so that the value of the email address is evaluated on runtime.

This way you don't have to care about URL encodings at all

The following user expressions can be used:

  • <User.displayname>

  • <User.uniquename>

  • <User.firstname>

  • <User.lastname>

  • <User.salutation>

  • <User.jobtitle>

  • <User.department>

  • <User.email>

  • <User.telephone>

  • <User.mobile>

  • <User.fax>

  • <User.streetaddress>

  • <User.city>

  • <User.zip>

  • <User.country>

  • <User.state>

  • <User.timezone>

udo

Former Member
0 Kudos

Hello Udo,

Thank you for the explanation but in my case I must to use it at the URL itself since it is coming from an email message that the user clicks on. Is there any way to implement your solution with my demands? And one more thing, my value is not User. value it is something that is being created on runtime (the request number for example...)

Roy

Former Member
0 Kudos

Hi,

you can define such a URL using the "DynamicParameter" parameter as desribed for example in the document "How to use portal navigation within a WD application" here in the SDN. You could also have a look to the new <a href="http://www.sap-press.de/international?titelID=1211">WD book</a> where we have a long chapter especially for the whole navigation issues.

Best regards

Jochen

Former Member
0 Kudos

Roy,

Check out the following forum posts. I think this is what you are looking for.

-Cindy

Former Member
0 Kudos

Hi Cindy,

Thank you for your response.

The solution at the first post was the one I was looking for, but I have a problem with it. It is working great when I test the application outside the portal but it doesn't work when the application is inside the portal. I know I can build fixed parameters when I build the iView the application is sitting on but the thing is that these parameters are not fixed and must go through the url parameteres since they are comming from a mail link (I am sending the user mail with link to the app that contains his request number and when he presses it I direct him to the app, take the parameter and direct him to his specific request).

Any idea/solutions for this?

Roy

Former Member
0 Kudos

Roy,

The only thing fixed needs to be the name of the parameter(s) in the query string. When the link is added to the email if should be able to replace the request number parameter value with whatever value is needed by the WD app.

example query string: myWDApp?reqnum=12345

Or am I missing what you are trying to do?

-Cindy

Former Member
0 Kudos

Hi Cindy,

Yes, you are missing something...

As I said this solution is working when testing it with the link the NWDS creates for the application, but I send the mail to the user I use a different URL which directs him to the application URL inside a portal Role, like this:

ROLE_URL = http://<server_name>/irj/portal?NavigationTarget=ROLES://portal_content/sampleQueries/DynPro/Committ...

Now, if I try to concatenate to this URL parameters, it directs to the application but ignores the parameters...

Roy

Former Member
0 Kudos

Hi Roy,

Are you encoding your URL parameters while appending it to this ROLE_URL?

What I mean is, the URL should be like this:

ROLE_URL= http://<server_name>/irj/portal?NavigationTarget=ROLES://portal_content/sampleQueries/DynPro/Committ...

Note that %3D stands for "?" and %3F for "=". Also you can try encoding the "/"s with "%2F".

Regards,

Satyajit.

Former Member
0 Kudos

Hey Satyajit,

Thank you for the response, I have few questions though:

1. You said that %3D stands for "?" and %3F for "=" yet at the URL example you wrote it upside down.

2. When I use %3F I get the "&", which one should I use for the "?" sign to indicate the first parameter?

3. Why do I need to encode the URL at first place and where can I find these encode codes?

Thank you in advance,

Roy

Former Member
0 Kudos

Hi Roy,

Sorry I messed that up

To answer your questions:

1. %3D stands for "=" and %3F for "?"

2. "&" is encoded as %26

3. Your application URL is part of a redirect URL. Generally redirect URLs themselves are sent as querystring parameters. So if you are planning to pass querystring parameters to your application, you will need to encode this (or so I think!). What I mean is an URL of the form

<i><protocol>://<server>/<main URL>?redirectURL=<your URL>?<your parameters></i>

will not work since two "?"s are confusing, to put it very simply.

You can find URL encoding characters<a href="http://www.blooberry.com/indexdot/html/topics/urlencoding.htm">here</a> among other places.

Also take a look at IWDWebContextAdapter.encodeRedirectURL() method.

Regards,

Satyajit.

Message was edited by: Satyajit Chakraborty

Former Member
0 Kudos

Hello again,

Unfortunally It does not solve the problem.

After the encoding, here is how the user get the link at the mail:

http://<server_name>/irj/portal?NavigationTarget=ROLES://portal_content/sampleQueries/DynPro/Committ...

When he presses this link this is what he gets at the browser:

http://<server_name>/irj/servlet/prt/portal/prtroot/com.sap.portal.navigation.portallauncher.default...

Note that the %3F has been encoded to & instead of ?

Roy

Former Member
0 Kudos

Hmmm... But does this launch the login page of the portal though? Or do you get a 404 error?

If you get the login page, what happens after you login?

Regards,

Satyajit.

Former Member
0 Kudos

I am being redirected into the application inside the portal, which is good but it is as before, the parameters are ignored. When I print them, I see null...

former_member182374
Active Contributor
0 Kudos

Hi Roy,

Try to define inbound plug in your first (default) iview.

This plug will have a parameter name like the querystring parameter. Then, set this parameter value in the context.

For example:

Application URL: http://WDAPP?param1=1234

inbound plug name: StartupPlug

StartupPlug parameters: param1

And then in the implementation:

public void onPlugStartupPlug(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String param1 )

{

//@@begin onPlugStartupPlug(ServerEvent)

wdContext.currentContextElement().setKey(param1);

//@@end

}

Omri

Former Member
0 Kudos

Hey Omri,

There are two problems:

1. The URL won't direct to the application unless all the parameters at the URL (including the first one) will have an & prefix, so I can't prefix the first parameter with ?, as usual.

2. I've created an inbound plug in my first default view but I don't see it reaches there at all. I printed something just to test and I don't see the print on the screen.

Any ideas....?