Skip to Content

Overview

     This document provide step-by-step instructions to create and delete selection screen elements.  Activity is controlled through the option selected in a RadioButtonGroupByIndex element.  Based on the RadioButton option selected ( Plant or Material ), Select-options for same displayed for user input.

Steps

  • Usage of Re-usable component for Select options (WDR_SELECT_OPTIONS)

     Image1.JPG

     Image1.JPG

  • Component Controller Contexts

               Node : RBGROUP – Radio button options

                            Cardinality : 0..n

                            Supply Function – FILL_RBTEXT 

      • Attributes
        • RBTEXT – String

         

  • Supply function FILL_RBTEXT for context RBGROUP

method fill_rbtext .
   data : ls_rbgroup type wd_this->element_rbgroup,
          lt_rbgroup type wd_this->elements_rbgroup.

   move 'Plant' to ls_rbgroup-rbtext.
   append ls_rbgroup to lt_rbgroup.

   move 'Material' to ls_rbgroup-rbtext.
   append ls_rbgroup to lt_rbgroup.

   node->bind_elements( lt_rbgroup ).
 endmethod.

  • Component controller Methods

    • SET_SELECTION_SCREEN – For creating selection screen
      • Importing parameter : INDEX type INT4 (Parameter based on select-options for Plant/Material is displayed)
METHOD set_selection_screen .
   DATA : lo_cmp_usage TYPE REF TO if_wd_component_usage,
          lo_interfacecontroller TYPE REF TO iwci_wdr_select_options,
          lv_r_helper_class TYPE REF TO if_wd_select_options.

   DATA : lt_range_table TYPE REF TO data.

   lo_cmp_usage =   wd_this->wd_cpuse_select_options( ).
   IF lo_cmp_usage->has_active_component( ) IS INITIAL.
     lo_cmp_usage->create_component( ).
   ENDIF.

   lo_interfacecontroller =   wd_this->wd_cpifc_select_options( ).
   lv_r_helper_class = lo_interfacecontroller->init_selection_screen( ).

   FREE : lt_range_table.

   IF index = 1. "Option for Plant"
     lt_range_table = lv_r_helper_class->create_range_table(
                          i_typename     = 'WERKS_D' ).
     CALL METHOD lv_r_helper_class->add_selection_field(
       i_id = 'WERKS'
       it_result = lt_range_table ).
     lv_r_helper_class->remove_selection_screen_item(
       i_id   = 'MATNR' ).
   ELSEIF index = 2. "Option for Material"
     lt_range_table = lv_r_helper_class->create_range_table(
                          i_typename     = 'MATNR' ).
     CALL METHOD lv_r_helper_class->add_selection_field(
       i_id = 'MATNR'
       it_result = lt_range_table ).
     lv_r_helper_class->remove_selection_screen_item(
       i_id   = 'WERKS' ).
   ENDIF.
 ENDMETHOD.

    • WDDOINIT – Controller Initialization
METHOD wddoinit .
   set_selection_screen( index = 1 ).
 ENDMETHOD.

  • Views – V_MAIN – Layout

Image1.JPG

Action “ON_SELECT” is assiged to OnSelect Event of the RadioButtonGroupByIndex element.

  • Views – V_MAIN – Context

Image1.JPG

  • Views – V_MAIN – Methods

    • Method : ONACTIONON_SELECT


METHOD onactionon_select .
   DATA : lv_index TYPE int4.
   wdevent->get_data( EXPORTING  name = 'INDEX'
                      IMPORTING  value = lv_index ).
   wd_comp_controller->set_selection_screen( index = lv_index ).
ENDMETHOD.

  • Window – W_MAIN

Image1.JPG

  • Output

    • RadioButton option : Plant

Image1.JPG

    • RadioButton Option : Material

Image1.JPG

Exclusions

  • Further data extractions based on input parameters are not mentioned in this document.
To report this post you need to login first.

4 Comments

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

Leave a Reply