Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
mohammed_anzys
Contributor
0 Kudos
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. 2. 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. 3. 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. 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.   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.
3 Comments