Skip to Content
Some of you may be wondering why i am so obsessed with webdynpro window dynamics :-), reference How to close parent window in Webdynpro applications?. , the reason is simple and it attributes to the numerous days i had spent on exploring the architecture and behaviour of webdynpro windows.In my last blog  I was going through the specifics of  closing the parent  window .In this edition, I will be covering more on the external window  creation and controlling.For those who are implementing external window in webdynpro  ABAP , it may be very difficult to control the external window once its opened as the normal close method will not work in the webdynpro ABAP.Dont worry  , I am explaining a step by step work around to achieve the same. 1. Creation of  External window. For creating an external window , first you need to create a webdynpro window so that you could embed the views for your external window. image2. Create a attribute in the Component Controller for window instance. Now we need to create an attribute in the component controller so that it could hold the instance of the external window. image3. Call the external window. Its upto to the designer’s discretion that where one wants to create the method for opening the external window. In my case I have created the method in the component Controller so that I could use the method irrespective of the views that I have.The one thing that you have to take care is that , before calling the window.open( )  method you should save the window instance in the component controller attribute that we have created in the previous step.This will enable us to control the window  further. image Data:l_cmp_api type ref to if_wd_component,      l_window_manager type ref to if_wd_window_manager,      l_comp_info type ref to IF_WD_RR_COMPONENT,      l_final_window type ref to IF_WD_WINDOW.      l_cmp_api = wd_this->wd_get_api( ).       CALL METHOD L_CMP_API->GET_COMPONENT_INFO        RECEIVING          COMPONENT_INFO = l_comp_info          .       l_window_manager = l_cmp_api->get_window_manager( ).     CALL METHOD L_WINDOW_MANAGER->CREATE_WINDOW      EXPORTING *       MODAL                = ABAP_TRUE        WINDOW_NAME          = ‘W_PERM_POP’ *       TITLE                = *       CLOSE_BUTTON         = ABAP_TRUE *       BUTTON_KIND          = *       MESSAGE_TYPE         = IF_WD_WINDOW=>CO_MSG_TYPE_NONE *       CLOSE_IN_ANY_CASE    = ABAP_TRUE *       MESSAGE_DISPLAY_MODE = *       DEFAULT_BUTTON       =      RECEIVING        WINDOW               = l_final_window        .  CALL METHOD L_FINAL_WINDOW->SET_WINDOW_POSITION       EXPORTING         LEFT     = 300         TOP      = 150 *        POSITION =         .  CALL METHOD L_FINAL_WINDOW->SET_WINDOW_SIZE      EXPORTING        WIDTH  = ‘3000px’        HEIGHT = ‘3000px’        . wd_this->LO_POP_UP = L_FINAL_WINDOW.   CALL METHOD L_FINAL_WINDOW->OPEN     .  Now you could place this component controller method in any actions of any views in the component where you want to call the pop up.  4. Closing and controlling the external window. You can create a method in the component controller to control the external window which is created. image  Data:l_final_window type ref to IF_WD_WINDOW.  l_final_window = wd_this->LO_POP_UP.  if l_final_window is not initial.           CALL METHOD L_FINAL_WINDOW->CLOSE               EXPORTING                  CONTROL_TO_FOCUS_ID =                  DELETE_WINDOW       = ABAP_FALSE                                     .  endif.  This snippet just explains the close functionality but you could also perform the other methods available in the IF_WD_WINDOW interface.
To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Thomas Szücs
    Nice blog. Should be really helpful to many developers who are new to handling multiple windows within Web Dynpro ABAP.

    Just a small additional comment. The window displayed is called a popup window. External windows exist as well. They can be created using method CREATE_EXTERNAL_URL_WINDOW of the same interface (IF_WD_WINDOW_MANAGER).

    Best regards,
    Thomas

    (0) 
  2. Sankar Rajendran
    Nice Blog. And I have few corrections over this.

    The window displayed above is neither an external window nor a pop up. It’s just displaying a window available in the WD component.

    For external and for popup windows we have the respective functions CREATE_EXTERNAL_WINDOW and CREATE_POPUP_TO_CONFIRM in the interface IF_WD_WINDOW_MANAGER.

    And in the given code snippet, for the “create_window” function the parameter for “window_name” must be ‘Z_POP_W’ instead of ‘W_PERM_POP’.

    (0) 
  3. Maheshkumar gattu
    here in close method what coudl be the exporting parameter we need to pass to control_to_focus_id ??

    if l_final_window is not initial.
    CALL METHOD L_FINAL_WINDOW->CLOSE
    EXPORTING
    CONTROL_TO_FOCUS_ID =
    DELETE_WINDOW = ABAP_FALSE
    .

    endif.

    (0) 

Leave a Reply