cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with order of init and exit calls.

Former Member
0 Kudos

I have an application with 2 views. One view is the form and the other is the result after submitting the form. I am subscribing to the team viewer in both views using WDPortalEventing. The problem occurs when the second view loads it's wdInit() is run before the wdExit() on the first view. I am subscribing to events in the wdInit() and unsubscribing in the wdExit(). This is causing a race condition which causes the event to be unsubscribed in the second view.

Is there any other way to do this? or anyway to ensure the the init and exit methods are called in an expected order?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Mark,

As per [WebDynpro Phase Model|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50b0f2aa-20d0-2a10-1685-d163d88a3e09], when an outbound plug is fired, the method call is treated as a 'Request For Navigation' and all requests are placed on a navigation queue where they wait for 'Navigation and View Initialization' step.

In 'Navigation and View Initialization' step, wdInit() method of target view is called if it is not already instantiated. After this, the wdExit() method of originating view is called. So, what you are experiencing is the normal Phase Model processing.

To bypass your issue, you may try subscribing to events in the event handler method for inbound plug in your target view.

Hope this helps.

Vishwas.

Former Member
0 Kudos

Thanks for explaining that.

Unfortunately the inbound plug is fired before the previous view's wdExit is called.

Former Member
0 Kudos

Hi,

Try to move your code to wdDoBeforeNavigation instead of wdDoExit.

Regards

Ayyapparaj

Former Member
0 Kudos

Thanks. That did it.

Answers (1)

Answers (1)

0 Kudos

Mark,

This is the sequence in which the methods are called on navigation.

FirstView - onActionDataEntered() -> Method that starts navigation

SecondView - wdDoInit()

SecondView - wdonPlugFromMainView()

FirstView - wdDoExit()

Try unsubscribing in the onActionDataEntered() -> Method that starts navigation instead of wdExit(). That should work.

Hope this helps.

Vishwas.

Former Member
0 Kudos

Thanks. I will look at this option too.