Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Basic Web Dynpro Application to display a Pop-up window on the browser. 
Steps to be followed:

  1. To create a Web Dynpro component.
  2. In addition to the main window and main view create another main window and main view.
  3. Populate the data, bind it and activate.
  4. 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
                     ).

  lo_window->open( ).

endmethod.
 
Ø      Now save and Activate the Web Dynpro Component.  
To create a Web Dynpro Application. 

  1. 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.

1 Comment

  1. Guest

    Interesting articel . Did you ever tried to show a modal dialog box  as a POP UP in Webdynpro ?

    We have a search help in our system, which creates  a modal dialog box as basis for selection screen . It works properly in normal dynpros, but it doesn't work in Webdynpro.

    There we get an error : " Sending of dynpro progname dynnumber  not possible. no windows system type specified".

    Are there any ideas to realize  this function?

    Veronika