cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown in ALV (WDA)

Former Member
0 Kudos

Hi,

I'm trying to put an dropdown by key (or index) into an ALV but I'm unable to get data in the dropdown. Can someone please help me with this?

The setup for the dropdown is like this (see below) but how can I bind a node DD_fieldname which has attributes 'key' and 'descr' to the dropdown.

  • Drop down box

DATA: lr_drdn_by_key TYPE REF TO cl_salv_wd_uie_dropdown_by_key.

CREATE OBJECT lr_drdn_by_key EXPORTING selected_key_fieldname = l_fieldname.

lr_column->set_cell_editor( lr_drdn_by_key ).

Thanks,

Kris

Accepted Solutions (0)

Answers (5)

Answers (5)

Madhu2004
Active Contributor
0 Kudos

Hi,

Try the below code;

l

o_value = lo_interfacecontroller->get_model(
  ).

  lo_table_settings ?= lo_value.
  lo_column_settings ?= lo_value.

  lo_table_settings->set_read_only( abap_false ).

ls_column = lo_column_settings->get_column( 'ACTIVE' ).

  CREATE OBJECT lo_ddk
    EXPORTING
      selected_key_fieldname = 'ACTIVE'.

  ls_column->set_cell_editor( lo_ddk ).

  ls_valueset-value = 'AAAAA'.
  ls_valueset-text = 'TEST CHAR1'.
  APPEND ls_valueset TO lt_valueset.

  ls_valueset-value = 'BBBBB'.
  ls_valueset-text = 'TEST CHAR2'.
  APPEND ls_valueset TO lt_valueset.

  ls_valueset-value = 'CCCCC'.
  ls_valueset-text = 'TEST CHAR 3'.
  APPEND ls_valueset TO lt_valueset.

  ls_valueset-value = 'DDDDD'.
  ls_valueset-text = 'TEST CHAR 4'.
  APPEND ls_valueset TO lt_valueset.

  lo_nd_alv_data_info->set_attribute_value_set(
  EXPORTING
     name = 'ACTIVE'
     value_set = lt_valueset ).

anil_w
Explorer
0 Kudos

Hi,

Apart for all of the above

you need table settings to be set as abap_false.

data: lr_table_settings type ref to if_salv_wd_table_settings.

lr_table_settings ?= lr_model.

lr_table_settings->set_read_only( abap_false ).

If you need the dropdown as not editable then please set

lr_dropdown->set_read_only( abap_true )

I did all this inside the component controllers init method

Thanks

Former Member
0 Kudos

hi

good

go through this link, i hope this ll help you to solve your probelm

/people/sap.user72/blog/2006/01/09/wda--user-defined-functions-in-alv

http://www.sap-press.de/download/dateien/933/sap_press_bsp_programming.pdf

thanks

mrutyun^

Former Member
0 Kudos

This is my code...

  • Drop down box

DATA: lr_drdn_by_key TYPE REF TO cl_salv_wd_uie_dropdown_by_key.

CREATE OBJECT lr_drdn_by_key EXPORTING selected_key_fieldname = l_fieldname.

lr_drdn_by_key->set_state( cl_wd_input_field=>e_state-normal ).

lr_drdn_by_key->set_enabled( abap_true ).

lr_column->set_cell_editor( lr_drdn_by_key ).

DATA lr_node TYPE REF TO if_wd_context_node.

DATA lr_node_info TYPE REF TO if_wd_context_node_info.

DATA ls_value TYPE wdy_key_value.

DATA lt_value_set TYPE wdy_key_value_table.

*----- get the pointer to meta data

lr_node = wd_context->get_child_node( 'QUOTATION_TO_CREATE' ).

lr_node_info = lr_node->get_node_info( ).

*----- build set of keys to slect from.

ls_value-key = 'KCF'.

ls_value-value = 'USer friendly text'.

APPEND ls_value TO lt_value_set.

ls_value-key = 'KEYVAL'.

ls_value-value = 'USer friendly text'.

APPEND ls_value TO lt_value_set.

*.... repeat append for as many entries required in dorp down

*----- Set attribute meta data

lr_node_info->set_attribute_value_set( name = `ATWRT005` value_set = lt_value_set ).

I can see that the value_set is correctly put in QUOTATION_TO_CREATE node but no values appear.

Suggestions anyone?

Former Member
0 Kudos

Hi Hans ..

Even i want to display a dropdown list in ALv toolbar..

Im udoing it using user defined functions...

In this part:------

  • Creating a DropDown List in ALV Toolbar.

DATA lr_drdwnui TYPE REF TO cl_salv_wd_fe_dropdown_by_key.

CREATE OBJECT lr_drdwnui EXPORTING selected_key_elementname = lr_column->id .

lr_drdwnui->set_label_text( 'Colors' ).

I want to know what value should selected_key_elementname have..

If i put a column anme ( ie attribute name ) ...it sayus could not find..\

plz help..

Former Member
0 Kudos

Hi Jagruti.

If you are trying to add a drop down by key in the ALV toolbar the selected_key_element_name has to be the name of an attribute of a node previously mapped to the node FUNCTION_ELEMENTS of the ALV component.

Regards, Pablo.

Former Member
0 Kudos

Hey Kris,

"CREATE OBJECT lr_drdn_by_key EXPORTING selected_key_fieldname = l_fieldname."

...

"lr_node_info->set_attribute_value_set( name = `ATWRT005` value_set = lt_value_set )."

Does l_fieldname match `ATWRT005'?

Regards,

George

Former Member
0 Kudos

To use drop down by key, use must change meta data. IE upate context_node_info.

To use drop down by index, you node must have an element collection.

Using DDBK as the example:


  DATA lr_node_info  TYPE REF TO if_wd_context_node_info.
  DATA ls_value      TYPE        wdy_key_value.
  DATA lt_value_set  TYPE        wdy_key_value_table.

*-----get the pointer to meta data
  lr_node_info = wd_context->get_node_info( ).
  lr_node_info = lr_node_info->get_child_node( `MY_NODE` ).


   
*----- build set of keys to slect from.

  ls_value-key   = 'KEYVAL'.
  ls_value-value = 'USer friendly text'.
  APPEND ls_value TO lt_value_set.

*.... repeat append for as many entries required in dorp down
  

*----- Set attribute meta data
  lr_node_info->set_attribute_value_set( name = `MY ATTR` 
                                                           value_set = lt_value_set ).

The values should now appear in list. The context will have the key value when selected.

regards

Phil.

Former Member
0 Kudos

I've tried this method but no data is shown in the DropDown box.

Is there no other way to bind the data directly with a node instead of creating a new value set with append.

Former Member
0 Kudos

Hi,

are you populating your dropdown list in the method init of your view?

it doesn't work otherwise

Mayaa