I was looking a way to close Webdynpro for ABAP application by a click of a button on my main view. I found one blog (How to close parent window in Webdynpro applications?. How to close parent window in Webdynpro applications?.) by Mohammed Anzy. Though the method described in this blog works but it requires to create 3 navigational plugs.
The webdynpro window can be closed by using only one navigational plug and little code. The following steps will perform this task.
- Create an outbound exit plug at your window. Please make the plug type as type 1 ( exit).
- Create a button on your view and assign an action to the event onAction.
- Create the method for the action with following code.
First in this method, your view controller instance is created
l _view_cntr = wd_this->wd_get_api( ).
Then the instance of window controller is obtained from embedded view controller.
l_win_cntr = l_view_cntr->get_embedding_window_ctlr( ).
At last, this code calles the window controller’s method Fire_plug to fire the outbound exit plug with parameter CLOSE_WINDOW. That makes the application window close.
This example was tested on ECC 6.0 with service pack 14.