Skip to Content

This post is part of the series, Web Dynpro Selection Screen Variants.

Part 5: Variants in Action

The series concludes with a demonstration of using component ZWDR_SELECT_OPTIONS_VARI within a Web Dynpro report selection-screen.

Open an existing Web Dynpro which implements a selection screen using component WDR_SELECT_OPTIONS. For this demonstration, we use a selection screen of fields from table SFLIGHT.

Add component ZWDR_SELECT_OPTIONS_VARI as a used component. Name the usage VARIANTS.


Add the VARIANTS used component interface controller to the view containing the selection screen,


In the view containing the selection screen, add the following into hook method WDDOINIT to initialize the variants component usage and link it with the current application and selection screen object. In the code snippet below, the object named selection_screen is the selection screen object obtained from the WDR_SELECT_OPTIONS component usage.

* -- Initialize the select-options variants component usage

  DATA(lo_cpuse_variants) = wd_this->wd_cpuse_variants( ).

  IF lo_cpuse_variants->has_active_component( ) IS INITIAL.
    lo_cpuse_variants->create_component( ).

* -- Initialize the variants component with this component's name, application and all
*    select-options

  DATA(lo_ifc_variants) = wd_this->wd_cpifc_variants( ).

    component_name     = wd_comp_controller->wd_get_api( )->get_component_info( )->get_name( )
    application_name   = wd_comp_controller->wd_get_api( )->get_component( )->get_application( )->get_application_info( )->get_name( )
    select_options_set = VALUE #( ( selection_screen ) )


In the view containing the selection screen, add a ViewContainerUIElement to the layout in the position where you want the variants button to appear. Assign the container ID, VC_VARIANTS.


Lastly, embed interface view W_VARI of used component ZWDR_SELECT_OPTIONS_VARI into ViewContainerUIElement VC_VARIANTS.

Run the Application

Now your selection screen will include a Variants button offering users three familiar options: Get, Delete and Save as Variant.

Get Variant

When the user selects to Get a variant, a search help will guide them to select a variant.

Delete Variant

When the user selects to Delete a variant, a search help will guide them to select one or more variants and a confirmation dialog will confirm the deletion.

Save as Variant

When the user selects Save as Variant, a dialog will prompt them to enter a name and description for their variant.

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply