Basic Web Dynpro Application to display a Pop-up window on the browser.
Steps to be followed:
- To create a Web Dynpro component.
- In addition to the main window and main view create another main window and main view.
- Populate the data, bind it and activate.
- Create a Web Dynpro application and execute it.
First to create a Web Dynpro Component.
Ø Create a web dynpro component say 'ZPOPUP_EXAMPLE' as shown.
Ø A window 'ZPOPUP_EXAMPLE' and a view 'MAIN'.
Ø Once the component is created after assigning it to a package, create another view say 'SUBVIEW' and another window say 'SUBWINDOW' and save it.
Ø Now on the right side you will find 2 windows and 2 views that you have created.
Ø Click on the main window i.e 'ZPOPUP_EXAMPLE'.You will find it to be like this.
Ø Now drag and drop the sub view 'SUBVIEW' on to the window 'ZPOPUP_EXAMPLE'.Now it will look like this.
Ø Now double click on your sub window 'SUBWINDOW'.It wont have views attached to it. So drag and drop both views and it will look like this after drag and drop.
Ø Save it and now double click on the main view 'MAIN' to design the layout.
Ø On the main view we just have a button on clicking that the pop up window should be displayed.
Ø Now we have to create a button on the layout of the view 'MAIN'.
Ø Name the button as 'POPUP' in the text field.
Ø In the events tab of the view, there is an 'OnAction' event.Create an action.
Ø Now Double click on the event we have just created i.e 'GET_POPUP'.
Ø Goto 'Code Wizard' and select the radio button 'Generate Popup'.
Ø Here we have to select the window which we want as a pop up window. In this case we want the 'SUBWINDOW' as pop up window. So press F4 and select the 'SUBWINDOW'.
Ø So some code will be inserted automatically in the method.
method ONACTIONGET_POPUP .
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window = lo_window_manager->create_window(
window_name = 'SUBWINDOW'
* title =
* close_in_any_case = abap_true
message_display_mode = if_wd_window=>co_msg_display_mode_selected
* close_button = abap_true
button_kind = if_wd_window=>co_buttons_ok
message_type = if_wd_window=>co_msg_type_none
default_button = if_wd_window=>co_button_ok
Ø Now save and Activate the Web Dynpro Component.
To create a Web Dynpro Application.
- Right Click on the Web Dynpro component and say Create->Web Dynpro Applictaion.
2. Now execute the Application.
The output will be as follows
Thus a pop-up window is displayed.