cancel
Showing results for 
Search instead for 
Did you mean: 

Fire plug in Controller?

Former Member
0 Kudos

Hi,

is it possible to fire an outbound plug in the component or custom controller?

Bye,

Chris

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Christoph,

You can fire outboundplugs of only the interface view from your component or custom controller. If you have defined an outbound plug in your interfaceView, you can fire it in your component controller like:

wdThis.wdGet<InterfaceViewController>().wdFirePlug<plug name>();

SAP recommends doing this inside the 'wdDoBeforeNavigation()' method. Please go through the comments for this particular method.

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Hello Chris,

It is not possible, just curious what is the scenario where you would like to achieve this?

Regards,

Dharmi

Former Member
0 Kudos

Hi Dharmi,

i.e. what do you do if the controller is the only one who can decide which view comes next (i.e. because of model state)

Former Member
0 Kudos

Hi Christoph,

As far as I know, there is no direct way to access a view from the component. When I have a similar requirement, I create an attribute in the default view to indicate which view is to be displayed and map it across to the component. Then from the component I set the value, and fire the corresponding plug inside the wdDoModify() of the default view.

I really wonder why SAP hasn't provided a direct method to choose the next view from within the component, even though webdynpro supports & recommends MVC architecture. If someone is aware of a better way to achieve the same, it would be very helpful if you could share the same.

Best Regards,

Nibu.

Former Member
0 Kudos

Hi Nibu,

you truly understand me.

...so you mean you store the next views name in the component context? But then you have a "big" switch statement to fire the different outbound plug, or is there a generic firePlug-method which takes the plugs name as parameter?

Former Member
0 Kudos

Hi Christoph,

yes, we need to call each plug individually as there is no built-in generic method for firing plugs based on a parameter.

Best Regards,

Nibu.

Former Member
0 Kudos

Doch!

Assuming that this code is part of <b>view controller</b> method:


final IWDAbstractViewInfo viewInfo 
  = ((IWDViewController)wdControllerAPI).getViewInfo();

final IWDOutboundPlugInfo plug 
  = viewInfo.findInOutboundPlugs( "<plug-name-here>" );

if ( null == plug )
{
  /* handle invalid param, i.e. no such plug */
}
else
  wdControllerAPI.firePlug
  ( 
    plug, Collections.EMPTY_MAP 
  );

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com

Former Member
0 Kudos

@Christoph

It is possible, but indirectly:

1. Create event in custom controller with one param -- plug name;

2. Subscribe to this event in view controller;

3. Use code from my previous post in event handler

VS

Former Member
0 Kudos

You can fire the plugs between the views not btn the components.

Regards, Anilkumar

Former Member
0 Kudos

Well,

It's a bit off-topic here, but anyway: it is possible to link 2 components, namely <b>interface views</b> of components, via plugs.

VS

thomas_szcs
Active Contributor
0 Kudos

Afaik yes. Both need to be linked from within the embedding component.

Former Member
0 Kudos

Thanks for all the tips!

But I wonder why the comment of the wdDoBeforeNavigation method sais "Firing outbound plugs is allowed in this hook."

Former Member
0 Kudos

> But I wonder why the comment of the

> wdDoBeforeNavigation method sais "Firing outbound

> plugs is allowed in this hook."

Does someone know how to fire an outbound plug in the wdDoBeforeNavigation method?