cancel
Showing results for 
Search instead for 
Did you mean: 

choose startup plug

Former Member
0 Kudos

Hi all,

in my WD application controller I'm executing some code in wddoInit method and, depending from the result of this code, I'd like to plug one view or another.

I try to use the wddoBeforeNavigation to fire an event, catch it in the default view and then fire plug to the second one but I have the following error:

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Cannot navigate from view DefaultView because it is not part of the current view assembly

how can I solve this?

thanks in advance,

Stefano

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Steffano,

What I understand is that you wish to navigate from one view to another if some condition is met for which you have written code in wdDoInit() method.

When you create a component, a window is created with the default startup plug & default view.

I hope you have already created the second view (say V2) for this same window.

Now, you need to create the outbound plug (say ToV2) for the default view, inbound plug for the 2nd view & the navigation link from outbound plug to inbound plug (this you can do in the Navigation Modeler which can be opened thru double click on the window in Web Dynpro Explorer).

Code to be written in view controller

// If your condition is met, then below code is called, which fires outbound plug to take you to 2nd view

if(condition) is true

{

wdThis.wdFirePlug<ToV2>();

}

Hope this solves your query.

Kind Regards,

Nitin

Edited by: Nitin Jain on Feb 15, 2009 9:58 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi all,

I found this documentation about the method wddobeforenavigation()

Navigation Preparation u2013 wdDoBeforeNavigation()

When executing large Web Dynpro applications, it might not be sufficient to ensure the consistency of the user entries by checking the individual contexts or all controller contexts within a single Web Dynpro component. SAP recommends that before you trigger a navigation change, you should check whether controller contexts of several Web Dynpro components contain valid data.

The Hook method wdDoBeforeNavigation() in the component controller allows you to execute such extensive and cross-component checks and display error messages, if necessary. This method is called by the Web Dynpro runtime before each processing of the navigation targets that have been accumulated till then. Only when the check is terminated, the Web Dynpro runtime assembles all views visible on the user interface (the new view assembly), initializes the view controller instances that have not been created yet and processes there the inbound plug event handlers defined by the navigation targets

So I fullfill my requirements with this code in wddoinit:

if (<condition>) {
  IWDWindowInfo myWindowInfo = wdThis.wdGetAPI().getComponentInfo().findInWindows("myWin");
  IWDViewUsageInfo myView2UsageInfo = myWindowInfo.getViewUsageByID("myView2");
  myWindowInfo.setDefaultRootViewUsage(myView2UsageInfo);
}

thanks to everybody.

Stefano

Former Member
0 Kudos

Hi all,

I'll try to better explain my problem.

I've already created a window and I've also included two views (view1 and view2). The first view (view1) is teh default view. I've created the plugs which connects view1 with view2.

Starting my application (this mean that no view has been displayed yet) I check for a condition and, if needed, I raise an event in the component controller.

The event is catched by view1 and in the event handler I fire the outbound plug toView2. At runtime this leads to the error reported.

I've later also tried to catch the event in the second view but in this case, view1 still appear since it is the default view.

It seems that I must display the default view before being able to fire any plug...

Any helps???

thanks

Former Member
0 Kudos

Hi,

I guess your scenario is that you have two views lets say View1 and View2 and based on some criteria you need to switch between them

Steps to be done

1) Open the window which contains this views (If not present add the views to the window), Even you can use a view container.

2) Create Inbound plug and outbound plugs respectively.

3) Use navigational link to connect this plugs.

4) From the code based on your condition fire respective plugs

Regards

Ayyapparaj