cancel
Showing results for 
Search instead for 
Did you mean: 

Call another component on fire plug..

Former Member
0 Kudos

Hi All

Assume the following set up - Comp A (view1) and Comp B (view2). I enter some data in view1 and it should be displayed in view2. Via the Interface controllers, I have done the relevant mappings so that data of Comp A (view 1) can be accessed in Comp B (view 2).

Now, how do i navigate from view 1 to view 2 to see the data and back to view 1 on clicking of a button in view 2...?? Different options could be:

1. Use fire plugs to do the navigation.

2. Or some other eventing mechanism.

Request you to please suggest me different ways (step by step in detail) on how we can achive this with the above 2 ways or if there are other ways also.

(For this sample app, I am using a standalone WD Project, no concept of Development Components here and at the moment Comp A is added in the Used Components of Comp B to access Comp A (view 1) data... )

Thanks

Deepak

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Deepak,

I don't see any way to navigate within a component (or DC) without using plugs. Either the view may be in the same window, be a part of the same viewset or in views in different windows of the same component using interface views or different views in different windows in different components of the same project using interface views and used components.

Therefore, you need to use plug and don't have an option in my knowledge.

You can navigate from one iView in a portal to another iView using WDPortalNavigation APIs and to external pages using LinkToUrl UI element.

Use following link to understand navigation using plugs between views of different components.

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/a137c339-0b01-0010-a688-a87b88706845

Regards,

Tushar Sinha

Former Member
0 Kudos

Hi Tushar

Thanks for the link. I had seen that doc earlier and was able to navigate between two views which are in different components. But how do i do data passing between the views which are in different components.

Say for example, V1 in C1 contains an input form with some fields and a button when clicked would navigate to V2 in C2 and in this V2 will display the data of V1.

I guess it is via the Interface Controllers and it's context mapping but dont know the exact steps to do it... Please guide me on this...

Also, one more doubt - If we can pass data from V1 to V2, is it also possible to pass data from V2 to V1..?? (Assuming only C1 and C2 exists and no other component, I guess it is not possible due to cycle error but if we follow the way navigation is done in the example article, it seems it can be done... Request you to please clarify...)

Thanks

Deepak

Former Member
0 Kudos

Hi Deepak,

There are actually two ways to pass values when you are using plugs to navigate.

1. In both the target and the source view, you have a tab called plugs if you can see. under this, all the inboundt and the outbound plugs are defined. When you click on any of the plug, you have a provision to enter the parameter to be passed with the plugs. So, you define the same parameter name for the outbound plug of the View1 and the inbound plug of View2. These parameters would be passed as arguments on firing of the plug as you can see in the implementation. Similarly, you can define N number of parameters of your data type. So, when the plug is fired, these parameters are passed.

All you have to do is set the parameter value when firing the plug as

wdThis.wdFirePlug<OutboundPlugName>(wdcontext.currentContextElement().getVa_Para1, 20);

Same is possible when you are using plugs between view and interface view. Just have a look.

Similarly, in the onPlug<YourInboundPlugOfView2>(value1, value2) method of View2 ,

you can get the values and set it to context or whatever by directly using the variables value1 and value2.

2. You can set the value(s) to be passed in context of View1 and define same context variable or node(with same structure) in View 2 and also in the component interface Controller of both the views . Now View1 can be mapped to Component Interface of Comp1 and View2 to Component interface of Comp2. But, you need to map both the Comp1 and Comp2 too to pass the value.

[Remember, mapping will help you to pass from 1 to 2 and 2 to 1, either ways because it is coming via Component Controller/Interface Controller. During navigation only views are destroyed and not the Component, so it will be stored there. making change at one place would be reflected to all the faces where mapping is done.]

So, you add the Comp2 in the Used Component of Comp1 first and then you can add dependency over Comp2 in the properties tab of Comp1. Then you can do mapping and call the methods defined in Comp2 in Comp1. Same can be done to add Comp1 as used Component of Comp2.

Hope you understood. Try doing it..you will understand.

Regards,

Tushar

Former Member
0 Kudos

Hi Tushar

A very clear explaination..!!

I shall try out the suggested ways and then will update this thread.. Again, thank you so much for your reply....

Thanks

Deepak

Former Member
0 Kudos

Hi

Sorry for updating the thread a bit late. I tried both the ways as suggested by Tushar and it works with ease.. Infact, the ways suggested are already simulated in of the articles on SDN. However, explaination given on this thread, made it more easier to understand...

Again, thanks..

Thanks

Deepak

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Deepak,

To Navigate from View1 to View2 You can use the fire plugs to do the navigation.

As you have mentioned hope you have created a node with the property IsInputElement set to true in the interface controller of CompB and it is mapped to the node with the same attributes in CompA so that the datas in the view1 can be accessed in View2 which is in a different component.Here we have to use the CompB as used Webdynpro component in CompA

Please fire a plug from View1 of CompA to the default plug of interface view of view2 of CompB and there you can access the node of the CompB's interface controller which mapped to CompA and you can use the same to display in the view.

And in the back scenario if you want to access View1 from View2 you cannot achieve it through adding the interface view of View1(CompA) in CompB ie) using CompA as usedwebdynpro component in CompB because it will through you an error as cycle of component usage.Instead please create an outbound plug in the Interface view of View2 (Comp B) and fire the plug to view1(CompA). Hope this will work.

Regards,

Meenakshi