cancel
Showing results for 
Search instead for 
Did you mean: 

Close Main Window on button click - WDA

Former Member
0 Kudos

Hi Experts,

I am trying to close the main window on a button click.

In the event on_click of the button, I have written the following code.

data: lo_view_api type ref to IF_WD_VIEW_CONTROLLER.

data: lo_window_ctlr type ref to IF_WD_WINDOW_CONTROLLER.

data: lo_window type ref to if_wd_window.

lo_view_api = wd_this->wd_get_api( ).

lo_window_ctlr = lo_view_api->get_embedding_window_ctlr( ).

lo_window = lo_window_ctlr->get_window( ).

lo_window->close( ).

The reference: 'lo_window' is not getting instantiated. Hence I am not able to get a reference of the main window.

Please suggest as how I can close the current window (which is the main window of my application) on button click.

.

Thanks

Akashdeep

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Akash,

Please follow this wiki.. it solves your problem

http://wiki.sdn.sap.com/wiki/display/WDABAP/CloseParentWindow-WDA

also read this...

http://help.sap.com/saphelp_nw70/helpdata/en/45/1bc575ba064574e10000000a114a6b/frameset.htm

Cheers,

Kris.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks All, I was not aware of calling the exit_pug via the window controller.

I was trying to fetch a reference of the window and close it. its via the window controller, and You have to fill the parameters.

Thanks for sharing the knowledge. Thanks a ton.

Former Member
0 Kudos

Do i understand you correctly that you want to close the window and thereby exiting the application ?

In that case you should not Do like this, you have to create a exit plug in the window with a parameter close_window of type wdy_boolean.

From your button handler, you need to fire the exit plug and supply the parameter close_window = abap_true.

PS: Use window as required controller in your view.

Exit plugs with close_window, only work under certain circumstances. The restrictions are listed in this help link:

[http://help.sap.com/saphelp_nw70ehp1/helpdata/en/9b/65e04ea1ae4d9d8cfd329afa43e869/frameset.htm|http://help.sap.com/saphelp_nw70ehp1/helpdata/en/9b/65e04ea1ae4d9d8cfd329afa43e869/frameset.htm]