cancel
Showing results for 
Search instead for 
Did you mean: 

SET_ON_CLOSE_ACTION ( view = ?

0 Kudos

hello webdynpro experts,

I'm new to webdynpro.

I have created a method in the component controller called OPEN_POPUP :

data:

lr_api_comp_controller type ref to if_wd_component,

lr_window_manager type ref to if_wd_window_manager,

lr_api_comp_controller = wd_this->wd_get_api( ).

lr_window_manager = lr_api_comp_controller->get_window_manager( ).

e_popup = lr_window_manager->create_window(

window_name = i_popup_name

BUTTON_KIND = i_button_kind

MESSAGE_TYPE = i_message_type

).

e_popup->open( ).

This is successful in the way that I can close the button. But how can I catch the event Close of the pop-up ?

I have tried to use the SET_ON_CLOSE_ACTION but I do not know what to put in the view parameter ?

Please note that I call this method from within another method in the same controller :

wd_this->open_popup(

i_popup_name = 'WND_PROCESS_DATE'

i_button_kind = if_wd_window=>co_buttons_close

i_message_type = if_wd_window=>CO_MSG_TYPE_QUESTION ).

where you can see that the pop-up has its own window but also its own view.

Please advise,

Thank you.

cheers,Zied.

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

good job Mohammed !

shwetars
Advisor
Advisor
0 Kudos

Hi Zied,

you need to pass the reference of the view in which action handler for the "CLOSE" exists.

for example,

if you are calling window "W1" which contains "V1", then you should create an action( under the actions tab of view V1 ) say "CLOSE", you can put the appropriate handling code here.

now within the method set_on_close_action you need to pass the reference to the above view and the above action name.

wd_get_api( ) can be used to get the reference to the view.

Regards,

Shweta

0 Kudos

hello ,

thanks for your reply.

I have unfortunately tried this option, but I got a Type conversion problem. Indeed you can see in the code snippet above that the type returned by wd_this->wd_get_api( ) is if_wd_component and not if_wd_view_controller which is the one needed for the View parameter of the method SET_ON_CLOSE_ACTION .

I did a cast as well but I got a runtime error

Are there other options ?

cheers,Zied.

mohammed_anzys
Contributor
0 Kudos

Hi

The error comes because you are running it in your component controller.i want you to do the following things.

In your component controller add an attribute lo_view of type if wdview_controller.

In your WDDOMODIFY of your view , set

wd_comp_controller->lo_view = wd_this->wd_get_api( ) .

Now back to your set_on_close method , use wd_comp_controller->lo_view to get the view name....Everything will work

Thanks

Anzy

Award points for useful answers.

0 Kudos

hello,

I did as you said and I have put a break-point in the HANDLE_CLOSE action but the event is still not caught .

do you think I need to add ?:

lr_popup->subscribe_to_button_event(

Thank you,

cheers,Zied.

0 Kudos

now it works with the subscribe stuff !

good job Mohammed.

mohammed_anzys
Contributor
0 Kudos

Hi

You could get the view instance from the view and save it the coponent controller instance.then use it for set_on_close.

lo_api TYPE REF TO if_wd_view_controller.

lo_api = wd_this->wd_get_api( ).

This method in teh view will give back the view controller...save it in the cmponet controller....

Thanks

Anzy

0 Kudos

hello Mohammed,

thanks for your reply.

I have unfortunately tried this option, but I got a Type conversion problem. Indeed you can see in the code snippet above that the type returned by wd_this->wd_get_api( ) is if_wd_component and not if_wd_view_controller which is the one needed for the View parameter of the method SET_ON_CLOSE_ACTION .

I did a cast as well but I got a runtime error

Are there other options ?

cheers,Zied.