cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a method of a view in popup view

Former Member
0 Kudos

Hi Experts,

I have created WDJ program. It has 3 views - view1, view 2 and 1 pop up view. view1 and view2 are in window1. popup view is in window2.

There are input and output plugs in view1 and view2. view1 and view2 are connected by navigation links and input / output plugs. I have created fire plug methods for link between view1 and view2. These fire plug methods are part of view1 and view2.

How we can access this method from component controller?

In fact I want to access the methods from popup view. I have created some method in component controller. I can access component controller methods from popup view.

My question is how we can access the fire plug methods of view1 and view2 in component controller.

Regards,

Gary

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Gary,

Depending on the requirement there is a workaround for your case. If the same case is required means you can't change it or you don't want to change it. Then you should proceed as follows.

1. create an event in the component controller.

2. subscribe that event in all the view's you want (i.e view1 view2 view3 ) and put the logic of the method in the event handler of subscribed event. this event handler will be called from any where you want no matter its component controller view controller or what ever. The catch is you have to trigger that event by component controller and you can access component controller from any where right?

But again i wouldn't recommend to follow this practice as long as its not very much required instead please change the approach and proceed. If you need any more help regarding this lets know.

Regards

Jeetendra

Former Member
0 Kudos

Hi Jeetendra,

I have created event in component controller.

I have also created event in pop up view. How I can subscribe the event of component controller in pop up view.

I have written following code in pop up view

public void onActionevent(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionevent(ServerEvent)
    wdThis.wdGetTest1Controller().WD_EVENT_NEWEVENT();

However it is not getting complied. I am getting message

The method WD_EVENT_NEWEVENT() is undefined for the type IPublicTest1	
Popup.java	test1/gen_wdp/packages/test1	line 168

Regards,

Gary

Former Member
0 Kudos

Hi Gray,

You don't need to create the event in the popup view, you should create the event handler and subscribe the event of the component controller for that go to the properties of view there select the event handlers and create event handler there you will find event source specify the component controller there and please note that you need to add the reference of component controller and in the subscribed event select the event you created in the component controller. Now in this event handler please put the code what ever you want. Now you can invoke the event of the component controller and the code of event handler will be executed.

Regards

Jeetendra

Abhinav_Sharma
Contributor
0 Kudos

HI Gary,

You can not use methods defined in View from any other view or component controller as these methods are private to the view. However, what you can call a component controller method from views and other custom controllers.

And so it is true for Plugs also, You can not call VIEW Plugs from component controller.

Regards

Abhinav

Edited by: Abhinav Sharma on Apr 28, 2011 9:47 AM