cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down for a table field

Former Member
0 Kudos

Hi Experts,

How do i make a field as drop down in output table in WD.

Thanks,

Hari

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Harikrishna,

check the following


  DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.

  LO_CMP_USAGE =   WD_THIS->WD_CPUSE_ALV( ).
  IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
    LO_CMP_USAGE->CREATE_COMPONENT( ).
  ENDIF.

   DATA LO_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
  LO_INTERFACECONTROLLER =   WD_THIS->WD_CPIFC_ALV( ).

    DATA LO_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
    LO_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
    ).
    data: lt_valueset type table of wdr_context_attr_value,
         ls_valueset type wdr_context_attr_value.
    ls_valueset-value = 1.
ls_valueset-text = 'First value'.
append ls_valueset to lt_valueset.

ls_valueset-value = 2.
ls_valueset-text = 'Second value'.
append ls_valueset to lt_valueset.

*loop at lt_ekpo into ls_ekpo.
*  ls_ekpo-valueset = lt_valueset.
*  modify lt_ekpo from ls_ekpo.
*  ENDLOOP.

 call method lr_nodeinfo->set_attribute_value_set
   exporting
     name      = 'VALUESET'
     value_set = lt_valueset
     .

  DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
        lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
        lr_drdn type ref to cl_salv_wd_uie_dropdown_by_idx,
        lr_editor type ref to cl_salv_wd_uie,
        lr_column type ref to cl_salv_wd_column.


  data: lr_table_settings type ref to if_salv_wd_table_settings.
  lr_table_settings ?= lo_value.
  lr_table_settings->set_read_only( abap_false ).
  lr_column_settings ?= lo_value.
  lr_column = lr_column_settings->get_column( 'NETWR' ).

*  CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'FIELD''.
create object lr_drdn
  exporting
    selected_key_fieldname = 'FIELD''
    .
call method lr_drdn->SET_valueset_fieldname
  exporting
    value  = 'VALUESET'
    .

  lr_column->set_cell_editor( lr_drdn ).


lo_nd_ekpo->bind_table( lt_ekpo ).


former_member184578
Active Contributor
0 Kudos

Hi,

You need to change the cell editor of column to drop down by key or drop down by index. then bind the drop down to the attribute and populate the values in init method.

check this article for reference: [Drop Down in Table in WDA|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c03227f9-e48f-2c10-4bad-8ebdec704f3d?QuickLink=index&overridelayout=true]

and, [Drop down in Table Ui in WDA|http://www.sapdev.co.uk/sap-webapps/sap-webdynpro/table-dropdown.htm]

Hope this helps u.,

Thanks & Regards,

Kiran.

former_member199125
Active Contributor
0 Kudos

First identify in which table column u want to identify dropdown,

then change table column cell editor to dropdownby key, then bind an attribute to selectedkey property of dropdownby key. And pass the values to that attribute suing set_attribute_value_set method, so that dropdown values will dispaly in table column

Regards

Srinivas