Start of Content Area

Background documentation Calling Dialog Boxes of the Same Component Locate the document in its SAP Library structure

      If the dialog box that you want to display is connected to the current component by content and was created specifically for this purpose, you should also create the corresponding window in this component.

      The CREATE_WINDOW method of the IF_WD_WINDOW_MANAGER interface allows you to create a dialog box in an event handler method from a displayed window at runtime. The name of the window to be opened is passed to the CREATE_WINDOW method as a parameter. An attribute of the type IF_WD_WINDOW must be declared for the dialog box in the view controller. In the example below, this is the m_popup1_1 attribute.

      This graphic is explained in the accompanying text

       

      The window used as the dialog box (in this case, POPUP1_1) must already exist in the component.

       

method onactionpopup1_1 .

 

  data: data: l_cmp_api           type ref to if_wd_component,

        l_window_manager    type ref to if_wd_window_manager.

 

  l_cmp_api           = wd_comp_controller->wd_get_api( ).

  l_window_manager    = l_cmp_api->get_window_manager( ).

  if wd_this->m_popup1_1 is initial.

    wd_this->m_popup1_1 = l_window_manager->create_window(

             window_name  = 'POPUP1_1'

             button_kind  = if_wd_window=>co_buttons_yesnocancel

             message_type = if_wd_window=>co_msg_type_question ).

  endif.

  wd_this->m_popup1_1->open( ).

 

endmethod.

 

      Note that the CREATE_WINDOW method only creates the new dialog box; it does not open it. To open the dialog box you also need the OPEN method.

The Buttons of the Dialog Box

      You use the BUTTON_KIND parameter to specify which buttons should appear in the dialog box. In the example above, the CO_BUTTONS_YESNOCANCEL constant is set. This constant is of the ABAP Dictionary type WDR_POPUP_BUTTON_KIND, the domain of which has a set of fixed values. The fixed values represent all the meaningful combination possibilities for dialog box buttons, such as OK, OK/Cancel, or Yes/No/Cancel. The default of the constant, an attribute of the IF_WD_WINDOW interface, is the value 5. That means that the combination contains the constants CO_BUTTON_YES, CO_BUTTON_NO, and CO_BUTTON_CANCEL, and that three buttons will be created in the dialog box, one each for Yes, No, and Cancel.

The Window of the Dialog Box

      In the WDDOINIT method of the view of the dialog box, the button constants are linked to appropriate actions. For this purpose, the IF_WD_WINDOW interface contains the SUBSCRIBE_TO_BUTTON_EVENT method. The actions must be created directly in the dialog box and the automatically created event handler methods must be programmed accordingly.

method wddoinit .

 

  data:

    l_api         type ref to if_wd_view_controller,

    l_window_ctlr type ref to if_wd_window_controller,

    l_popup       type ref to if_wd_window.

 

  l_api         = wd_this->wd_get_api( ).

  l_window_ctlr = l_api->get_embedding_window_ctlr( ).

  if l_window_ctlr is bound.

    l_popup       = l_window_ctlr->get_window( ).

    if l_popup is bound.

      l_popup->subscribe_to_button_event(

                 button            = if_wd_window=>co_button_yes

                 button_text       = 'Yes'                   "#EC *

                 action_name       = 'YES'

                 action_view       = l_api

                 is_default_button = abap_true ).

      l_popup->subscribe_to_button_event(

                 button            = if_wd_window=>co_button_no

                 button_text       = 'No'                 "#EC *

                 action_name       = 'NO'

                 action_view       = l_api

                 is_default_button = abap_true ).

      l_popup->subscribe_to_button_event(

                 button            = if_wd_window=>co_button_cancel

                 button_text       = 'Cancel'            "#EC *

                 action_name       = 'CANCEL'

                 action_view       = l_api

                 is_default_button = abap_true ).

    endif.

  endif.

endmethod.

 

       

Note The phase model instance of the dialog box is attached to the same component as the instance of the calling window. For this reason, when the dialog box is opened not only are all the Hook Methods of the view called that are displayed in the dialog box, all the hook methods of the view that are imbedded in the calling window are called as well.

 

The WDDOONOPEN and WDDOONCLOSE Methods

Every window controller has the WDDOONOPEN and WDDOONCLOSE hook methods. These two methods are only processed when a window is opened or closed as a dialog box. Since the opening of a dialog box does not involve any navigation, no inbound plug is called and therefore no event handler method is processed. The WDDOONOPEN method can therefore be used to implement initializations.

 

 

End of Content Area