Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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?fr...

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.

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

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

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

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

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

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

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.

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

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.

Give input to execute Selection criteria.

Output :

6 Comments
Labels in this area