Skip to Content
Author's profile photo Krishna Reddy B

How to Use New Select-Options WD_SELECT_OPTIONS_20.

This Document helps you to create new Select-Options WD_SELECT_OPTIONS_20.

Product Version :  SAP NetWeaver 7.0 Enhancement Package 3

                           SAP NetWeaver 7.3 Enhancement Package 1.

Please check sap help WD_SELECT_OPTIONS_20.

http://help.sap.com/erp_hcm_ias_2012_03/helpdata/en/f4/418d5173434a1ebea11c4c505543e3/content.htm?frameset=/en/0b/2e4531d2aa444c87238124d8a3e76e/frameset.htm

Step 1 : Go to se80->create webDdynpro component with initial view and window.

Step 2 : Go to Component ->Under used components tab->Use  standard  component WD_SELECT_OPTIONS_20 under component and give component use name as SELECT_OPTIONS.

/wp-content/uploads/2013/05/img1_216269.png

Step 3 : Go to view->view properties tab->click on controller usage and select your select_options create just now.

/wp-content/uploads/2013/05/img2_216270.png

/wp-content/uploads/2013/05/img3_216272.png

Step 4 : Go to View layout tab-> Create view container ui element.

/wp-content/uploads/2013/05/img4_216239.png

Step 5: Go to windows->right click on viewcontainer->embed your select options component.

/wp-content/uploads/2013/05/img5_216240.png

/wp-content/uploads/2013/05/img6_216241.png

After Embeding Select options to view container it looks like below.

/wp-content/uploads/2013/05/img7_216242.png

Step 6 : Go to  view WDDOINIT method-> Go to code wizard-> Select Instantiate used component->Click F4 Select Select_options.

/wp-content/uploads/2013/05/img8_216243.png

/wp-content/uploads/2013/05/img9_216244.png

Step 7 : Go to code wizard->Select  Method call in Used Controller->Select Component->Select Method INIT_SELECT_OPTIONS.

/wp-content/uploads/2013/05/img10_216245.png

/wp-content/uploads/2013/05/img11_216302.png

Step 8 : Write code to add Attributes to Selection Screen.

Here Complete code in WDDOINIT method.

method WDDOINIT .

method ONACTIONGET .

*– Instantiate the used component –*

  data lo_cmp_usage type ref to if_wd_component_usage.

  lo_cmp_usage =   wd_this->wd_cpuse_select_options( ).


 
if lo_cmp_usage->has_active_component( ) is initial.
    lo_cmp_usage->create_component( ).
 
endif.

*– To call the method in the used controller –*

  DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_WD_SELECT_OPTIONS_20 .
       lo_INTERFACECONTROLLER = wd_this->wd_cpifc_select_options( ).

  DATA lv_sel_opt_handler TYPE ref to if_wd_select_options_20.

       lv_sel_opt_handler = lo_interfacecontroller->init_select_options( ).

*– Add Attributes to Selection Screen –*

  DATA lt_attributes TYPE TABLE OF WDR_SO_S_ATTRIBUTES.

  DATA ls_attributes TYPE WDR_SO_S_ATTRIBUTES.

  DATA lt_initial_data TYPE TABLE OF WDR_SO_S_VALUES.

  DATA ls_initial_data TYPE WDR_SO_S_VALUES.

  ls_attributes-ATTRIBUTE  = ‘VBELN’.

  ls_attributes-ATTR_TYPE  = if_wd_select_options_20=>e_attribute_types-id.
  ls_attributes-TEXT      
= ‘Sales Document’.
  ls_attributes-dataelement =
‘VBELN_VA’.

  APPEND ls_attributes TO lt_attributes.

  ls_attributes-ATTRIBUTE  = ‘MATNR.

  ls_attributes-ATTR_TYPE  = if_wd_select_options_20=>e_attribute_types-id.
  ls_attributes-TEXT      
= ‘Material.
  ls_attributes-dataelement =
‘MATNR. 

  APPEND ls_attributes TO lt_attributes.

  lv_sel_opt_handler->add_attribute( EXPORTING attributes = lt_attributes ).

endmethod.

Step 8 : Go to view context->create node with attributes.

/wp-content/uploads/2013/05/img12_216303.png

Step 9 : Go to view layout create one action button, using wizard create table.

/wp-content/uploads/2013/05/img13_216304.png

Step 10 : Go to button on action, and write below code.

*– To call the method in the used controller –*

method ONACTIONGET .

  DATA lo_INTERFACECONTROLLER TYPE REF TO IWCI_WD_SELECT_OPTIONS_20 .
       lo_INTERFACECONTROLLER = wd_this->wd_cpifc_select_options( ).

  DATA lv_sel_opt_handler TYPE ref to if_wd_select_options_20.
  lv_sel_opt_handler = lo_interfacecontroller->init_select_options( ).

  DATA lo_nd_n_vbap TYPE REF TO if_wd_context_node.
 
DATA lt_n_vbap    TYPE wd_this->Elements_n_vbap.

  DATA lt_input TYPE TABLE OF WDR_SO_S_VALUES.
 
DATA ls_input TYPE WDR_SO_S_VALUES.

  DATA lt_vbeln TYPE TABLE OF RANGE_VBELN_VA_WA.
 
DATA ls_vbeln TYPE RANGE_VBELN_VA_WA.
 
DATA rs_vbeln TYPE RANGE_VBELN_VA_WA.

  DATA lt_matnr TYPE TABLE OF RANGE_MATNR.
 
DATA ls_matnr TYPE RANGE_MATNR.
 
DATA rs_matnr TYPE RANGE_MATNR.

  DATA lt_range_ref TYPE TABLE OF wdr_so_s_range_ref.
 
DATA ls_range_ref TYPE wdr_so_s_range_ref.

  DATA : rt_vbeln TYPE REF TO data,
         rt_matnr
TYPE REF TO data.

  field-symbols: <fs_vbeln> TYPE table,
                 <fs_matnr>
TYPE table.

*– Read Data and as range table –*
  lv_sel_opt_handler->get_input_complete_as_range(
importing range_ref = lt_range_ref ).

  LOOP AT lt_range_ref INTO ls_range_ref.
   
CASE ls_range_ref-attribute.
     
WHEN ‘VBELN’.
        rt_vbeln = ls_range_ref-range.
     
WHEN ‘MATNR’.
        rt_matnr = ls_range_ref-range.
   
ENDCASE.
 
ENDLOOP.

  assign rt_vbeln->* to <fs_vbeln>.
 
loop at <fs_vbeln> into rs_vbeln.
        ls_vbeln-
sign   = rs_vbeln-sign.
        ls_vbeln-option = rs_vbeln-option .
        ls_vbeln-low    = rs_vbeln-low.
        ls_vbeln-high   = rs_vbeln-high.
       
APPEND ls_vbeln TO lt_vbeln.
 
endloop.

  assign rt_matnr->* to <fs_matnr>.
 
loop at <fs_matnr> into rs_matnr.
        ls_matnr-
sign   = rs_matnr-sign.
        ls_matnr-option = rs_matnr-option .
        ls_matnr-low    = rs_matnr-low.
        ls_matnr-high   = rs_matnr-high.
       
APPEND ls_matnr TO lt_matnr.
 
endloop.

*– Select Query –*

  SELECT vbeln
         posnr
         matnr
         arktx
         zmeng
FROM VBAP
              
INTO CORRESPONDING FIELDS OF TABLE lt_n_vbap
              
WHERE vbeln IN lt_vbeln
              
AND   matnr IN lt_matnr.


*– Bind Table –*
* navigate from <CONTEXT> to <N_VBAP> via lead selection
  lo_nd_n_vbap = wd_context->get_child_node( name = wd_this->wdctx_n_vbap ).

  lo_nd_n_vbap->bind_table( lt_n_vbap ).

endmethod.

Output : Selection Screen.

/wp-content/uploads/2013/05/img14_216305.png

Give input to execute Selection criteria.

Output :

/wp-content/uploads/2013/05/img15_216306.png

Assigned tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks ! It was helpful

      Author's profile photo Narasimha Rao
      Narasimha Rao

      Thank you for sharing..Good one

      Author's profile photo Ramakrishnappa Gangappa
      Ramakrishnappa Gangappa

      Thanks for sharing.

      Author's profile photo pavan kulkarni
      pavan kulkarni

      Very Nice Document. Thanks.

      Author's profile photo Joao Sousa
      Joao Sousa

      It seems with select_options_20 we lose the hability to cast a range from excel into the select range, which is very useful.

      Am I missing how to do it, or did we really lose the functionality?

      Author's profile photo Former Member
      Former Member

      How to add multiple copy paste functionality here?