Overview
Interface IF_WD_WINDOW_MANAGER provides four methods for creating a secondary window in a Web Dynpro ABAP component. These methods may be used to open either a modal dialog window with content from a Web Dynpro component or an independent browser window with a URL address. Each method is discussed below and an example is given of its implementation.
Jump to:
CREATE_EXTERNAL_WINDOW | Creates an independent, external browser window with URL address. |
CREATE_POPUP_TO_CONFIRM | Creates a modal dialog window for displaying a simple text message with optional icon. |
CREATE_WINDOW | Creates a modal dialog window for displaying an interface view of the current component. |
CREATE_WINDOW_FOR_CMP_USAGE | Creates a modal dialog window for displaying an interface view of a component usage. |
CREATE_EXTERNAL_WINDOW
This method creates an independent, external browser window with URL address. It may be used to open a secondary browser window containing a different web application or an internet website.
Procedure
1.0 Create a Web Dynpro Component
Create a Web Dynpro component, ZDEMO_POPUPS with a view, V_MAIN and window, W_MAIN. Also create an application for the component.
2.0 Create a Window Attribute
In the component controller, create a public attribute WINDOW to store a reference to the popup window object. Having a reference available as a public attribute enables us to access and control the popup window from any view.
3.0 Create a LinkToAction with Event Handler
In the layout of view V_MAIN, create a LinkToAction element with the following properties.
Properties (LinkToAction) | |
---|---|
ID | CREATE_EXTERNAL_WINDOW |
text | CREATE_EXTERNAL_WINDOW |
Events | |
onAction | POPUP_EXTERN_WINDOW |
4.0 Implement Event Handler POPUP_EXTERN_WINDOW
Implement the event handler method for the LinkToAction element as follows.
METHOD onactionpopup_extern_window. DATA lo_api_component TYPE REF TO if_wd_component. DATA lo_window_manager TYPE REF TO if_wd_window_manager. * Get the window manager lo_api_component = wd_comp_controller->wd_get_api( ). lo_window_manager = lo_api_component->get_window_manager( ). * Create the external window wd_comp_controller->window = lo_window_manager->create_external_window( url = 'http://scn.sap.com' title = 'CREATE_EXTERNAL_WINDOW Example' modal = abap_false has_menubar = abap_true is_resizable = abap_true has_scrollbars = abap_true has_statusbar = abap_true has_toolbar = abap_true has_location = abap_true use_post = abap_false ). * Open the external window wd_comp_controller->window->open( ). ENDMETHOD.
5.0 Run the Application
Save, activate and run the Web Dynpro application. Clicking the CREATE_EXTERNAL_WINDOW link opens a new browser window showing the SCN home page.
CREATE_POPUP_TO_CONFIRM
This method creates a modal dialog window for displaying a simple text message with optional icon. With this method, there is no need to specify an interface view to contain the text message; the interface view is provided by the runtime.
Procedure
6.0 Create a LinkToAction with Event Handler
Repeat steps 1.0 Create a Web Dynpro Component and 2.0 Create a Window Attribute of section CREATE_EXTERNAL_WINDOW to create a new Web Dynpro component or skip these steps and extend the component created in section CREATE_EXTERNAL_WINDOW.
In the layout of view V_MAIN, create a LinkToAction element with the following properties.
Properties (LinkToAction) | |
---|---|
ID | CREATE_POPUP_TO_CONFIRM |
text | CREATE_POPUP_TO_CONFIRM |
Events | |
onAction | POPUP_TO_CONFIRM |
7.0 Implement Event Handler POPUP_TO_CONFIRM
Implement the event handler method for the LinkToAction element as follows.
CREATE_WINDOW
describe what it does and what we'll show in the example
Procedure
1.0 title
s
2.0 title
s
Result
s
CREATE_WINDOW_FOR_CMP_USAGE
describe what it does and what we'll show in the example
Procedure
1.0 title
s
2.0 title
s
Result
s