cancel
Showing results for 
Search instead for 
Did you mean: 

Dropdown list in alv toolbar

Former Member
0 Kudos

Hello,

I am trying to get a dropdown column in an ALV table. While searching in the forum I now have the dropdown in thr ALV column 'VALUE' but I am not able to to get values in the column.

I have one node called 'RES' type WDR_CONTEXT_ATTR_VALUE with the attributs VALUE and TEXT and the following coding:

***********************ALV INIT

data: lr_if_controller type ref to iwci_salv_wd_table,

lr_cmdl type ref to cl_salv_wd_config_table,

lr_cmp_usage type ref to if_wd_component_usage.

  • Instantiate ALV1 component

lr_cmp_usage = wd_this->wd_cpuse_alv( ).

if lr_cmp_usage->has_active_component( ) is initial.

lr_cmp_usage->create_component( ).

endif.

  • Get reference to model

lr_if_controller = wd_this->wd_cpifc_alv( ).

lr_cmdl = lr_if_controller->get_model( ).

data: lr_col type ref to cl_salv_wd_column,

lr_dropdown type ref to cl_salv_wd_uie_dropdown_by_key.

create object lr_dropdown

exporting

selected_key_fieldname = 'VALUE'.

lr_cmdl->if_salv_wd_table_settings~set_read_only( abap_false ).

lr_col = lr_cmdl->if_salv_wd_column_settings~get_column( id = 'VALUE' ).

lr_col->set_cell_editor( lr_dropdown ).

****************************************

data: lt_valueset type table of wdr_context_attr_value,

ls_valueset type wdr_context_attr_value,

lr_node type ref to if_wd_context_node,

lr_nodeinfo type ref to if_wd_context_node_info.

lr_node = wd_context->get_child_node( name = wd_this->wdctx_res ).

lr_nodeinfo = lr_node->get_node_info( ).

ls_valueset-value = '1'.

ls_valueset-text = 'eins'.

append ls_valueset to lt_valueset.

ls_valueset-value = '2'.

ls_valueset-text = 'zwei'.

append ls_valueset to lt_valueset.

lr_nodeinfo->set_attribute_value_set(

exporting

name = 'VALUE'

value_set = lt_valueset

).

data: itab_res type table of wd_this->element_res,

stru_res type wd_this->element_res.

append stru_res to itab_res.

lr_node->bind_table( itab_res ).

Anyone knows what I am doing wrong?

regards

Stefan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

1. done it without alv.(drop down with data)

2. replace the view table to alv table.

3. change the alv field to dropdown(the same code 'ALVINIT() )

thanks.

Yashpal
Active Contributor
0 Kudos

Hi ,

I think its not get updated because the external context mapping of the node is done at design time... so remove the design time mapping and do the dyanamic mapping .. once the attributes valueset is updated.. see the below code...

Instantiate ALV component

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

ENDIF.

  • Pass context node to ALV

DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .

l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).

l_ref_interfacecontroller->set_data( dyn_node ).

hope this will help ..............

Regards

Yash

Former Member
0 Kudos

Hello Yash,

when trying your coding I do not get drop down and no values.

regards

stefan