Calling Dialog Boxes of a Used Component 
If the dialog box that you want to display is of a generic nature and can be used in many different components, you create the corresponding window in a separate component that is then used by the current component. In this case, you create the dialog box at runtime in the current component using the CREATE_WINDOW_FOR_CMP_USAGE method and pass the name to the interface view and the component usage. There must be a component-usage entry in the attribute table of the current component for the component to which the dialog box belongs.
Syntax
method ONACTIONPOPUP2_1 .
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_popup2_1 is initial.
wd_this->m_popup2_1 = l_window_manager->CREATE_WINDOW_FOR_CMP_USAGE(
interface_view_name = 'MAIN'
component_usage_name = 'USAGE_POPUP2_1' ).
endif.
wd_this->m_popup2_1->open( ).
endmethod.
Unlike with dialog boxes of the separate component, the buttons of the dialog box that is to be opened cannot be created in one of the methods on the view controller of the calling view as buttons can only be set by the 'owning' component. This step is implemented in the window controller of the WDDOONOPEN hook method for dialog boxes of components created for use by other components (see Calling Dialog Boxes of the Same Component).
Syntax
The following source code shows the WDDOOPEN method on the controller of the dialog box:
method wddoonopen . if window_descr->is_popup = abap_true. window_descr->window->set_button_kind( if_wd_window=>co_buttons_yesnocancel ). window_descr->window->set_message_type( if_wd_window=>co_msg_type_question ). endif. endmethod.
Note
If the dialog box is not part of the separate component, but was created in a used component, the phase model instances of the two windows are not attached to the same component either. If the dialog box is open, only the hook methods of the views that are embedded in the dialog box will be processed.