cancel
Showing results for 
Search instead for 
Did you mean: 

Fire an action in ModifyView

Former Member
0 Kudos

Hi,

is it possible to fire an event in ModifyView? I need this scenario to fire out a plug. I know that this is not possible to fire plugs in ModifyView but maybe when I fire an action?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi there

It gives another possibility to "fire" a action into the wdDoModify event. As others discussed you can't fire it directly, because the wdDoModify is static. But what you can to is fire it "deferred".

Add a TimedTrigger to your view;

Property: delay = 1 (or maybe it also works with 0)

Create an Action ("onAction") for it and put your wdThis.wdFire.. there.

In addition, bind the property enabled to your context and set it in the wdDoModify via wdContext.currentContextElement.setTimerOn(true);

With this trick you can redirect your view in about 1 second.

Best regards

Marco

Former Member
0 Kudos

Hello Marco,

thank you for your answer. Can you please explain your suggestion clearer?

0 Kudos

Hi,

To achive your functionality there is a simple concept of SAP Webdynpro JAVA called DC to DC communication.

you no need to use URL of Secnod DC in first DC.

you can navigate from DC1 view2 to DC2 View3 and you can come back from DC2 view3 to DC1 view1.

Please follow the steps given in the following link.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0ae5f90-1679-2c10-4183-8c64cf932...

Hope this will help you.

Thanks & Regards,

Bhargava.

Former Member
0 Kudos

Hi,

the problem is that I already habe a usage of comp1 in comp2. so I cannot make a usage of comp2 in comp1. I can make the usage only in one direction? this is the problem which I have.

0 Kudos

Hi,

If you already used the public part of dc1 into dc2 then you no need to do in reverse way.

you can communicate two DC in bi-directional way. see the given reference link in my first reply.

Don't confuse in dc1 and dc2, just think as source and destination DC's and go through the tuotrial and cross check & apply

the steps according to your requierment.

Let me know if still facing the problem.

Thanks& Regards,

bhargava.

Qualiture
Active Contributor
0 Kudos

Although it is highly discouraged -- and I certainly would reconsider your program flow -- it is possible to trigger an action, which in turn fires a plug:

In method wdDoModifyView:

...
wdThis.onActionYourActionName(null); // just set parameter wdEvent to null
...

in method onActionYourActionName:

...
wdThis.wdFirePlugYourPlugName();

Former Member
0 Kudos

Hello Robin,

thank you for your answer. This scenario I already tried. When I execute this action in modifyView it doesn't fire the plug. What I don't understand is that he execute the method onActionYourActionName but didn't fire the plug.

When I create a button on the view and set this method to the button, you can fire the plug by pushing the button but not without pushing it.

So there must be a difference between pushing the button on the view and executing the method onActionYourActionName in modifyView.

Qualiture
Active Contributor
0 Kudos

Hi,

The main difference is that wdDoModifyView is made static, mainly to discourage this way of programming eventing / firing plugs before output has been rendered (see also JavaDoc comments for this method)

However, I'm not quite sure why your plug isn't fired when called by the action from within wdDoModifyView. I have tested it and it should work just fine... you're sure the onActionZzz() method is reached properly?

Best,

Robin

Former Member
0 Kudos

Hello Robin,

this is the coding which I used in ModifyView:


wdThis.onActionFirePlug(null);


  public void onActionFirePlug(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionFirePlug(ServerEvent)
	  wdComponentAPI.getMessageManager().reportSuccess("enter event");
	  wdThis.wdFirePlugOut();
	  
	  wdComponentAPI.getMessageManager().reportSuccess("enter after fire plug");
    //@@end
  }

Qualiture
Active Contributor
0 Kudos

Hi,

My apologies, it seems the application I checked for the same way of firing seem to work in a slightly different way (it opens a modal dialog in wdDoModifyView, and upon closing the dialog it fires a plug in the same method. This works well)

I tried with a sample WD, without modal dialog, and now I experience the same behavior as you did... so it seems firing plugs from the static method before rendering is indeed not possible in normal circumstances...

Is there a way you could fire the plug after rendering the view?

Former Member
0 Kudos

Hi,

I think it is clearer when I give more informatio about my process.

I have 2 DCs: DC1 and DC2

DC1 has View1 and View2 and DC2 has View3

Actually I execute a a URL to go from DC1 View2 to DC2 View3. After user has finished his entries in View3 of DC2 he can go back with history -1 programatically.

The problem is that I only get the event modifyView of View2 of DC1 after navigation via history-1. What I want to solve is, to open View1 of DC1 and not View2, but with navigation history-1 you always get the last view of your last application.

So this is why I want to fire a plug in modifyView of View2 as this is the only event I reach after history-1.

Qualiture
Active Contributor
0 Kudos

Hi,

If you want to combine two DC's, I'd recommend a dynamic usage of both (see the blog at /people/reema.mittal/blog/2010/11/10/dynamic-webdynpro-component-usage--extensibility-technique for some ideas)

That way, you should be able to have a WD button / link action that fires the appropriate plug to your desired DC

Edited by: Robin van het Hof on Mar 28, 2011 1:34 PM