Creating Enhancement set:
To call a custom component as a popup, the standard WEB UI component needs to be enhanced. To do this, a enhancement set should be created.
Go to transaction SM34, Enter BSPWDVC_CMP_EXT and Click maintain. Give your own name with the corresponding name space with the description and save.
Go to Transaction SM30, enter BSPWDV_COMP_EXT and select the value from the F4 values and save.
The enhancement set is created.
In the first part after the creation of the custom component, an Inbound plug OpenUrl is created under the Main window.
Go to the run time repository and create a navigation link between the main window and the view as follows.
Save the runtime repository.
Go to the component work bench BSP_WD_CMPWB and enter the standard component which needs to be enhanced.
In the component in our example BT115IT_SLSO, the view BTITEMS is selected and press the Enhance component button on the application tool bar.
Give the enhancement name created above(ZMULTIOFFER in this example) .
Enter the Application name. This application name should be starting with Z name space.
Follow the rest steps and Save the component. In the resultant view the name of the implementation class will be starting with Z.
Double click the implementation class of the view BTITEMS and redefine the method PREPARE_TOOLBAR. In this example, a new button is added at the item level in the sales order. By clicking this button, the popup will be launched. In the redefined method, the additional code to create the button is written as below.
Create a component usage in the runtime repository of the standard component and include the created custom component in it.
and save the runtime repository.
Create an event NEW from the event handler of the implememtation class. This will create a method EH_ONNEW in the implementation class. Create a variable lv_popup of type ref to if_bsp_wd_popup should be declared in the attributes of the implementation class.
Enter the below coding in the EH_ONNEW method.
IF lv_popup IS NOT BOUND.
lv_popup = me->comp_controller->window_manager->create_popup(
iv_interface_view_name = 'Z_POPUP/MainWindow'
iv_usage_name = 'CUPopup'
iv_title = 'Popup' ).
lv_popup->set_window_width( iv_width = 600 ).
lv_popup->set_on_close_event( iv_view = me iv_event_name = 'EH_ONRETURN').
lv_popup->open( 'OPENURL' ).
Open the sales order scree in the WEB UI. The new button will be appearing in the item tab. Click the new button to see the popup.
In this example an URL is launched as a popup. This can be improved to create a table view or any structure in the popup and some selection also can be done in the popup.
To come back to the original screen, an additional event will be required in the custom component(e.g .a button ) and an outbound plug.
Please let me know you valuable comments. Thanks!