cancel
Showing results for 
Search instead for 
Did you mean: 

passing a parameter while calling a web dynpro application on portal

former_member1191927
Participant
0 Kudos

Hi all,

I have an web dynpro application which will be called by two different links on the portal ( I have created one web dynpro Iview and two links to it).

This application will internally call an RFC and needs to pass a differnt parameter based on the link which has called this application. For example, if link1 calls the web dynpro app, then the parameter to be passed to the RFC is '1' and if link2 calls the RFC, then the parameter to be passed is '2'.

So is there any way of finding out, clicking on which link on the portal is our web dynpro application getting triggered?? If we know that then based on the that i can pass the corresponding paremeter to the RFC.

Any info on this would be of great help.

Regards,

Narahari

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sunil,

Make sure you are checking for the same values as the ones being passed through the url. If you pass 'cust' as the url parameter('param=cust'), you have to check if the value is 'cust', not 'customer'. i.e

if(param =="cust")

{

.

.

Other than this the code looks fine.

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Hi Nibu,

I have given the same parameter values, tht was just a typing error In both places I have given the values 'customer' and 'supplier' , but it doesnt return any value. Any idea what the problem could be?

Thanks.

Former Member
0 Kudos

Hi

Seems like some kind of confusion in the code. You said you are having 2 App parameters in the single WebDynpro iView. param="cust" & param="sup"

Now if it is declared like the above, meaning you have hardcoded the parameters.

in that case when the code to get the parameter executes which value will it return as you have 2 App parameters with the same name "param".

What you should have is param1="cust" & param2="sup"

now if that is the case then it is not going to serve your purpose as you need to have a single parameter which takes in the value of cust or sup based on the link clicked.

Now when you say you click on the link1 (i dont understand this).. does it mean you have 2 pages containing the same WebDynpro iView.

If you can clarify on this then we can see what problem you are facing.

Note : if you declare a App parameter say param1="cust" and then use webcontext adapter to retrieve, it will retrieve. (Also portal and Webdynpro runtime should be same just in case..

Hope that helps.

regards

Ravi

Former Member
0 Kudos

Hi Sunil,

The problem is with your String comparison. Use .equals() or .equalsIgnoreCase() to compare strings.

if(param.<b>equals</b>("customer")

{

.

.

Hope this helps,

Best regards,

Nibu.

(It would be very encouraging if you could get me some points from Narahari

former_member1191927
Participant
0 Kudos

Hi Nibu,

Here we have used the "Application paramters" option in the iview properties to pass the parameters, as the link for our iview is not exactly a hyper link to pass the values like you mentioned.

Please let us know if the API you mentioned is the right API for accessing the parameters passed when passing parameters from the "Application parameters" option.

Regards,

Narahari

Former Member
0 Kudos

hi narahari

Are both your j2ee instances same... if so then you should be able to get the values.

regards

Ravi

former_member1191927
Participant
0 Kudos

Hi Nibu,

This has solved our probelm. I have awarded you the maximum points:)

Thank you very much.

Regards,

Narahari

Former Member
0 Kudos

Hi Nibu,

It worked! Thanks a lot...and narahari will award u points..dont worry

Former Member
0 Kudos

Thanks for the points Narahari !

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Narahari,

Let your first link have the target as :-

http://....../<project_name>/<application name>?param=first

and your second url be

http://....../<project_name>/<application name>?param=second

Inside you view, you can read the url parameter like :

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

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Hi Nibu,

I am working with Narahari on this.

I tried putting 2 Application parameters in the 2 iviews that I have created on the portal : param=cust & param=sup respectrively.

Now, in my Web Dynpro project I have inserted this piece of code in the component contoller:

String param =WDWebContextAdapter.getWebContextAdapter().getRequestParameter("param");
	    if(param =="customer")
	    {
			inputpr.setPo_User_Type("01");
	    }
	    else if(param =="supplier")
	    {
			inputpr.setPo_User_Type("02");
	    }

I need to send 01/02 to the backend depending on which iview is accessed on the portal. But this is not working and data is not being retrieved. Can U kindly help me out.

Thanks.