cancel
Showing results for 
Search instead for 
Did you mean: 

How to fill ALV dropdown field ?

gerd_hotz
Contributor
0 Kudos

Hello experts,

I have a alv table in my web-dynpro and have made one

field to a dropdown field.

But how can I fill this dropdown field ?

Here my coding in order to make the field a dropdown field:

DATA :list_field TYPE REF TO cl_salv_wd_uie_dropdown_by_key.

LOOP AT lt_columns INTO ls_column.

CASE ls_column-id.

WHEN 'CONCATSTATUSER'.

CREATE OBJECT list_field

EXPORTING

selected_key_fieldname = 'CONCATSTATUSER'.

ls_column-r_column->set_cell_editor( list_field ).

ENDCASE.

ENDLOOP.

I've read in other threads that i can use

mehtod set_selected_key_fieldname.

But how can I use this method ?

Has somebody an example ?

Thanks Gerd

Accepted Solutions (1)

Accepted Solutions (1)

gerd_hotz
Contributor
0 Kudos

Hi,

I've checked the coding but I do not understand

how to do the method.

This is what I do, but I still do not get some values in

the dropdown-field:

DATA lr_dropdown TYPE REF TO cl_salv_wd_uie_dropdown_by_key.

LOOP AT lt_columns INTO ls_column.

CASE ls_column-id.

WHEN 'CONCATSTATUSER'.

CREATE OBJECT lr_dropdown

EXPORTING

selected_key_fieldname = 'CONCATSTATUSER'.

lr_dropdown->set_selected_key_fieldname( 'DRP_DWN_VALUES' ).

ENDCASE.

ENDLOOP.

Is there something wron or missing ?

Best regards

Gerd

Former Member
0 Kudos
CREATE OBJECT lr_o1 EXPORTING SELECTED_KEY_FIELDNAME= '<viewname.contextnode.attrib

utename>'.

Dont forget to fill the internal table as i told you and then follow this step....

lr_nodeinfo->set_attribute_value_set(
exporting
name = '<attribute name>'
value_set = lt_valueset
).

gerd_hotz
Contributor
0 Kudos

Hello again,

can you give me please a coding where I can see the method selected_key_fieldname

and the filling of the data for this ?

I've tested again but I'm not able to get a dropdown with vlaues.

THANKS

Gerd

gerd_hotz
Contributor
0 Kudos

Hello,

problem is solved now.

I had to extend my output-structure with the field 'valueset',

and then I could fill it with the values for the dropdown.

That was the problem.

But it would be nice if someone of the experts could write

a small tutorial about this, so many user could do much

easier !

T H A N K S

Gerd

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

> I had to extend my output-structure with the field 'valueset',

> and then I could fill it with the values for the dropdown.

You shouldn't have had to do any such thing. You don't create an additional attribute for the valueset; you should create the valueset directly against the attribute that will hold you key value. If you had to create a new context node for the value set then it sounds like you are actually using DDLBbyIndex instead of DDLBbyKey.

>But it would be nice if someone of the experts could write

a small tutorial about this, so many user could do much

easier !

There is a tutorial already in the online help:

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bb/69b441b0133531e10000000a155106/frameset.htm

Answers (1)

Answers (1)

Former Member
0 Kudos

If you are using CL_SALV_WD_UIE_A_DRDN_BY_KEY as dropdown

use SET_SELECTED_KEY_FIELDNAME method to set the selected key property and fill the values using


data:
lr_node type ref to If_Wd_Context_Node.

data : lr_nodeinfo type ref to if_wd_context_node_info,
lt_valueset type wdr_context_attr_value_list,
ls_valueset type wdr_context_attr_value,
WA TYPE SPFLI.


lr_node = wd_context->get_child_node( 'node name' ).
lr_nodeinfo = lr_node->get_node_info( ).


* USE UR TABLE AND FILL ACCORDINGLY 
SELECT * FROM SPFLI INTO WA.
ls_valueset-value = 'key1'. " actual values
ls_valueset-text = WA-CARRID. " text displaying on the dropdown
append ls_valueset to lt_valueset.
ENDSELECT.

lr_nodeinfo->set_attribute_value_set(
exporting
name = '<attribute name>'
value_set = lt_valueset
).

Hope it will work.