cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameter to another view in the same component.

Former Member
0 Kudos

Hi Experts,

On click of a table row, I need to pass a parameter to another view in the same component. I have created an outbound plug with the parameter in the first view and inbound plug with parameter in the second view.. ut stil the value exchange is not happening...

Request your inputs on this....

Please note that I am very much new to WD....

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

in view1 create a outbound plug (toview2)give the parameters , String str, int i for example

in view2 create a inbound plug (fromview1)give the parameters , String str, int i

in view1, create action for on table select. let ur table node structure

context

|-table

|-no(int)

|-name(String)

write the code in

onActionTableSelect()
{
int no=wdContext.currentTableElement().getNo();
String name=wdContext.currentTableElement().getName();
wdThis.wddoFirePlugToView2(no,name);
}

in view2

you will get these parameters

in

wdDoFirePlugfromView1(String str, int i)
{
wdComponentAPI.getMessageManager.reportSuccess(i+"  "+str);
}

here you can get the selected table values

Regards,

Naga

Answers (2)

Answers (2)

arun_srinivasan
Contributor
0 Kudos

Hi

In the inbound plug method similar to this method below

public void onPlugin_bound(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, String val )

{

//@@begin onPlugin_bound(ServerEvent)

//@@end

}

If you are not getting value for val. Check whether you are passing it in table view.

Thanks and Regards,

Arun

dhawal_joshi
Employee
Employee
0 Kudos

Hi ,

On a click of table row , capture and event and in the implementation of the code, populate the data and fire the plug Kindly check that before firing the plug your parameter is properly populated . Ideally there should not be any problem passing the parameter in this manner .

Another and a better way to achieve this is via context , create an attribute in context populate it from one of the view, navigate to another and read the same attribute from second view ( you have to map the same context attribure to both the view controller context ) . This way you get a flexibility to add/ remove / change the attribute.

regards

Dhawal

Message was edited by:

Dhawal Joshi

Former Member
0 Kudos

Hi Dhawal,

Thanks for the Prompt reply...Theoritically I am aware of what needs to be done... but when I convert the same to technical, I think am missing something...

I would appreciate if you can explain on technical terms with some examples..

Regard

SAP User.

Former Member
0 Kudos

Hi,

The <b>parameter name in both the OutBound Plug and Inbound Plug should be same</b>.

I tried as below but did not work

In view1create a outbound plug with parameter "param" of type "string"

In view2 create a inbound plug with parameter "paramIn" of type "string"

Try compiling it throws error

the below worked

In view1create a outbound plug with parameter "param" of type "string"

In view2 create a inbound plug with parameter "param" of type "string"

In view2

wdComponentAPI.getMessageManager.reportSuccess(param);

this displayed the value

Former Member
0 Kudos

One possible solution:

- Create attribute A in component controller (CC)

- Add CC as used controller for both view controllers

- In both view contexts, create attribute A and map it to A from CC

Before navigating away from view 1, set attribute A. In view 2, read attribute A, it will contain the value set in view 1.

Armin