cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Client side eventing in Webdynpro

Former Member
0 Kudos

Hi All,

I have the following scenario to implement in Webdynpro using Client-side eventing.

I have one page consisting of one Portal iview Pv1 and an Webdynpro iview Wd1.

In Pv1, there is an button which fires a client side event named "event1" using

EPCM.raiseEvent( "urn:clientside", "event1", index );

In Wd1, i have two views view1 and view2 and view1 is visible initially. There is a button But1 in view1 to navigate to view2.

Now on the click of the button in Pv1, i need some process to happen in view1 and i implement this by subscribing the portal event:

WDPortalEventing.subscribe("urn:clientside", "event1",wdThis.wdGetAction1Action());

in the Init method of view1 and it works fine.

Now i need to navigate to view2 from view1 and need to use the same event "event1" in view2 also. So, i unsubscribed the event before leaving view2

WDPortalEventing.unsubscribe("urn:clientside", "event1",wdThis.wdGetAction1Action());

wdThis.wdFirePlugToview2();

And everything worked fine upto this.

When i am in view2, i need to portal button to take me back to view1. i.e., on the click of the button in portal iview, i need to navigate from view2 to view1 in webdynpro iview.

To do this, i used the follwing set of codes in view2

public void wdDoInit()

{

WDPortalEventing.subscribe("urn:clientside", "event1",wdThis.wdGetAction2Action());

}

public void onActionaction2(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

WDPortalEventing.unsubscribe("urn:clientside", "event1",wdThis.wdGetAction2Action());

wdThis.wdFirePlugToview1();

}

But in the end, on the click of the button in portal, i can see the the webdynpro iview navigation to view1 from view2, but suddenly it throws the following error

com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Instance of view controller view2 does not exist.

To summarise my scenario,

When view1 is visible in Wd1 iview, the portal event should do some process in the view1 and it is working fine. When i navigate from view1 to view2, the click of the portal button should take me back to view1 and i am facing error in this step.

I don't find any flaw in my coding i have given above. Correct me if you find any. Or, if you have any other way to implement my scenario, Please reply back.

I would be very thankful for any help.

Regards,

Vijay.K

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can also give a try using the inter-application navigation in portal. Here is the following working code to call iview from each other, on an action:

WDPortalNavigation.navigateAbsolute(

"ROLES:portal_content/com.cv.kaar.Test_Page2",

WDPortalNavigationMode.SHOW_INPLACE,

(String) null,

(String) null,

WDPortalNavigationHistoryMode.NO_DUPLICATIONS,

(String) null,

(String) null,

"Name=" + wdContext.currentContextElement().getName());

Regards

Srinivasan T

Former Member
0 Kudos

Hi All,

I am working on the same scenario. But there is a slight deviation from what was told by Vijay.

I have some process to be done (set values) when navigating from wd1 view2 to wd1 view1.

When i try to use this navigationAbsolute() method,

values which i set in wd1 view2 which i want to get reflected in wd1 view1 will not available in wd1 view1.

Is it possible for you to help me out in this.

Thanks,

Bhuvana

Former Member
0 Kudos

Use Inbound and Outbound Plugs to navigate from one view to another.

You can pass parameters using Plugs and navigateAbsolute method.

Please also refer some wonderful tutorials prepared Jochen Guertler in

https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro

Regards,

Subramanian V.

Former Member
0 Kudos

Hi All,

Thank you for you support to solve my problem. I used the WDPortalNavigation to refresh my page again and hence navigate to the first view without any problem.

But, i couldn't pass the parameters for the refreshing iview. However, i solved it by using a separate java class to hold the state.

thanks again.

Regards,

Vijay.K

Former Member
0 Kudos

Hi Vijay,

Can u write the code for "holding the state for the page". I am facing same issue

Regards

Hemant

Former Member
0 Kudos

Hi Hemant,

I just use a static member in a java class which i deployed along with my webdynpro application. Since it is a static member, its value remained unchanged upon refreshing the page.

So, i just populated this value in view2 before refreshing the page and used this value in the doInit() of view1, which gets loaded after refreshing. Hence it seems like passing parameter to the view1 from view2.

Hope you understand.

Regards,

Vijay.K

Message was edited by: Vijay Kannan

Answers (0)