cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass parameter while navigating from one view to another

amber_garg
Active Participant
0 Kudos

I am using outbound plugs and inbound plug to navigate from one view to another which works fine. Now what i want is that there is a node which is declared in context of only VIEW1 (not Comp Controll).Now while navigating to another view VIEW2 i want this node's value to be passed as a parameter in the outbound plug to the inbound plug of VIEW2.

While creating outbound plug for view1 , I gave the Parameter name as "PAR_1" and type as "string". Then in the coding of action in VIEW1 , i used to code (from wizard) to fire the outbound plug along with the parameter.

Now on the recieveing end in VIEW2 how do i get the value of parameter "PAR_1". I can't see "PAR_1" in VIEW2 although i have given the parameter for outbound plug in VIEW1.

THANKS

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

hi

In the view2 , when you have created the inbound plug one eventhandler with name handle<plugname> will automatically get created.

there in that eventhandler, you will have only one parameter shown above that is of type wdevent.

there create one more with the same name and type as you have created for the outbound plug in the view1.

and then you can access its value directly form there.

in your case create a parameter of type string and name PAR_1 in the handle<inboundplug name> in view 2.

and then you can access that value from this parameter.

thanks

sarbjeet

amber_garg
Active Participant
0 Kudos

THans sarbjeet and sahai , once again

I did the same what you guys told and it is working fine too. Just 1 warning message is coming in the code "The cast operation (f1 != f2 , MOVE f2 ? to f1) is currently only supported in object references.".

Though its a warning only and if i ignore the program gives the correct output but still i would like to know if i am doin something wrong.

1 more thing. THe parameter which i created in the inbound plug event (as u people said) , why i have to give the same name of parameter as PAR_1. Ideally according to languages like C++ and java , the parameters of the functions in the defintion need not have the same name as the parameter in the calling statement

THANKS

sahai
Contributor
0 Kudos

hi amber,

since you are passing the parameters from a view to another view this is locally transferre rite?....since it is local transfer the name of parameters should be the same if not given same it will result and errror because the system wont be able to map the value passed and recived.

thanks and regards,

sahai.s

amber_garg
Active Participant
0 Kudos

@sahai: THanks for your answer

So i understood that why we have to give the same name of the parameter. But that warning comes even when the parameter is same. Any idea about it??

gill367
Active Contributor
0 Kudos

WARNING IS COMING because you are using somewhere this ?= operator to downcast some variable in the code.

double click on the warning and it will take you that code.

and yeah you have to give the same name to the parameter in the eventhandler.

thanks

sarbjeet

sahai
Contributor
0 Kudos

hello amber,

i think that you have used some sql statement in the code where you are assigning the par_1 to some value in view 2 apart from mention name and type in the outbound/inbound plug..am i correct? if this is the case ....can you paste that code.because type cast error arises in sql statements generally

thanks and regards,

sahai.s

amber_garg
Active Participant
0 Kudos

@sahai: Hey no , I am using very very simple example without any query or complex statement. I just have 2 radio buttons in VIEW1. On clicking the radio button, the naviagtion to view2 is done and the value of selected radio button is passed as a parameter in the plug.

In the view2 , i just have a caption in my layout where i am displaying the parameter value by setting the attribute.THe warning i get is in view2. Here is the code. Apart from this there is no coding in view2.

METHOD HANDLEPLUG_IN_V2 .
    DATA:
      NODE_CAPT_MSG                       TYPE REF TO IF_WD_CONTEXT_NODE,
      ELEM_CAPT_MSG                       TYPE REF TO IF_WD_CONTEXT_ELEMENT,
      STRU_CAPT_MSG                       TYPE IF_VIEW2=>ELEMENT_CAPT_MSG ,
      ITEM_MSG                            LIKE STRU_CAPT_MSG-MSG.
*   navigate from <CONTEXT> to <CAPT_MSG> via lead selection
    NODE_CAPT_MSG = WD_CONTEXT->GET_CHILD_NODE( NAME = `CAPT_MSG` ).

*   get single attribute
    NODE_CAPT_MSG->SET_ATTRIBUTE(
      EXPORTING
        NAME =  `MSG`
        VALUE = PAR_1 ).


ENDMETHOD.

sahai
Contributor
0 Kudos

hi amber,

i guess i got it....

i think that the par_1 is string type and value is made to recieve the char type values..check once please and revert

thanks and regards,

sahai.s

gill367
Active Contributor
0 Kudos

Hi Amber,

Just double click on that warning message it will take to you the code line where the cast operator is begin used.

and then just modify the type required according to the that.

then,warning will go away

thanks

sarbjeet

amber_garg
Active Participant
0 Kudos

Yeah , sahai. I checked the type of the attribute in VIEW1 which is string. PAR_1 is referring to that attribute only.

amber_garg
Active Participant
0 Kudos

@sahai: the attribute type is string and PAR_1 type is string too .Also the attribute in VIEW2 which i m setting the value is also of type STRING.

@sarbjeet: When i double click on the warning msg it , takes me to the layout page and then nothing happens

gill367
Active Contributor
0 Kudos

And when you are not using the parameter is this warning not coming ?

this is coming because of the use of cast operator only if you are not using it framework is using it.

thanks

sarbjeet

sahai
Contributor
0 Kudos

hi amber,

right click on the name of the code and go to checks and click extended check this will lead you to the slin analysis click on execute icon and not the standard execute icon....just quote what exactly it prompts.

regards,

sahai.s

amber_garg
Active Participant
0 Kudos

@sarbjeet: Actually when i write the code for setting attribute to a CAPTION with the value of PAR_1 then the warning comes (although the executions work successfully). If i comment this piece of code , the warning doesnt come.

@sahai: Where to right click exactly?? . Name of the code means which place ?

THANKS

sahai
Contributor
0 Kudos

AMBER,

RIGHT CLICK ON THE NAME OF THE PROGRAM IN SE80..

REGARDS,

SAHAI.S

gill367
Active Contributor
0 Kudos

What is the type of msg attribute in the node in the view 2.

it may not be of type string.

check it.

thanks

sarbjeet

amber_garg
Active Participant
0 Kudos

@sarbjeet: I checked once again the type of attribute in view2 , its STRING only

@sahai: I check SLIN overview and it is showing 2 erros and 3 warnings in "FIELD CHECK" and 1 error in "syntax check warnings" (although in my prog it was showing only 1 warning total).

When i double click on FIELD CHECK warnings it gives details that 3 variables ie ELEM ,ITEM and 1 more are not referenced in my prog .(That is because i have declared them but not using them anywhere afterwards)

When i double click on FIELD CHECK Errors, it says "No write access to ELEM_CAPT_MSG takes place" which again i think is because i have declared it but not used it.

When i double click on SYNTAX CHECK WARNING , i get the same details which were coming in my program regarding casting.

"Syntax check warning

The CAST operation (f1 != f2, MOVE f2 ?TO f1) is currently only supported for

object references."

THanks

amber_garg
Active Participant
0 Kudos

Hey Guys ,

I was looking at the code again and one thing caught my attention which might be related to this warning. THE ATTRIBUTE "MSG" and its node is not defined in the component controller but only in the 2nd view (as local). Is this the cause of the warning.If yes then what is the way to use the OBJECT to a local node and attribute in the program (is it the same as we do for COmponent controller nodes n attributes?)

THanks

sahai
Contributor
0 Kudos

hi amber,

whenever we make the node in component controller we make it as a global node i.e that very node will be availiable in all views in that particular code....whereas when we make a node in a view we make it local to that very node ...i.e suppose we make a node1...in view 1 this node will only be seen in view 1 but if same noe is declared in component controller then view1 as well as view2 will be able to use that node.....

try this information and check whether something helps revert back in case of issues.

regards,

sahai.s

amber_garg
Active Participant
0 Kudos

@sahai: Thanks for your answer

Yeah i am clear about this concept thats why i have declared the attribute only in VIEW2 (not in comp controller) because it is not required by VIEW1.

Thanks

Answers (1)

Answers (1)

sahai
Contributor
0 Kudos

hi amber,

transfer of parameters between views are done by using otbound/inbound plug and the handelers of that plug.

now,

check you eventhandler in the second view you will find there a parameter of type wdevent ...there you will have to make one more parameter of the type you want ...i.e in your case par_1 string type now having made that you will be able to access the value using this parameter.

best wishes.

regards,

sahai.s