cancel
Showing results for 
Search instead for 
Did you mean: 

How to return value from a method in DC2 to DC1?

Former Member
0 Kudos

Hi,

In DC1, I call a method in DC2 which shows a table in a dialog box. User selects a row and I want to return a value back to DC1.

For example, In DC1, on click of a button, I call a method (showDialog) in interface controller of DC2.

wdThis.wdGetShowDialogUCInterface().showDialog();

This shows the dialog from DC2 but how would I get the value back to DC1. Because this method does not wait till dialog box closes.

Thanks.

Regards,

Suresh.

Accepted Solutions (1)

Accepted Solutions (1)

vijayakhanna_raman
Active Contributor
0 Kudos

Hi,

When returning a value from Dc2 call the inteface controller in the onaction method of Dc2. from the interface controller fire the event and then handle the event in the Dc1.

Check with this link for server side eventing.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tu... on server-side eventing - 14.htm

U can close the Dc1 window by creating the window instance

and close it by window.close

U can check with this link to close the Dc2 window

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tu... on creating dialog boxes - 10.htm

Regards,

Vijayakhanna Raman

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suresh,

Correct me if I am wrong, but you basically want to get a return value from your dialogue box when it is closed. This you could achieve as follows:

1. Create a event (ex CloseButtonEvent) in your controller associated with your dialogue box view. Add parameters that you wish to pass to the event.

2. Create a event handler for the event in your main view (in the methods tab). Here you need to specify the controller raising the event and the name of the event itself.

3. You will now be able to access the event parameters from the dialogue box in your main view (in the event handler method).

More on dialog boxes <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tu">here</a>

I hope this helps.

Good luck.

Atul