on 05-30-2008 9:50 PM
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?
I was watching this threads on topics at the forum, but I can not solve this problem.
Copy my code.
DATA: lr_col TYPE REF TO cl_salv_wd_column,
lr_dropdown TYPE REF TO cl_salv_wd_uie_dropdown_by_key,
l_cmp_usage TYPE REF TO if_wd_component_usage,
l_alv_model TYPE REF TO cl_salv_wd_config_table,
l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table.
l_cmp_usage = wd_this->wd_cpuse_doc_measure( ).
IF l_cmp_usage->has_active_component( ) IS INITIAL.
l_cmp_usage->create_component( ).
ENDIF.
l_ref_interfacecontroller = wd_this->wd_cpifc_doc_measure( ).
l_alv_model = l_ref_interfacecontroller->get_model( ).
l_alv_model = l_ref_interfacecontroller->get_model( ).
l_alv_model->if_salv_wd_table_settings~set_read_only( abap_false ).
lr_col = l_alv_model->if_salv_wd_column_settings~get_column(
id = 'VALEUR_DIFF' ).
CREATE OBJECT lr_dropdown
EXPORTING
selected_key_fieldname = 'VALEUR_DIFF '.
lr_col->set_cell_editor( lr_dropdown ).
DATA:
lo_nd_ctx_tab TYPE REF TO if_wd_context_node,
lo_ndinfo_ctx_tab TYPE REF TO if_wd_context_node_info,
lt_value_set TYPE TABLE OF wdr_context_attr_value,
ls_value_set TYPE wdr_context_attr_value.
ls_value_set-value = '01'.
ls_value_set-text = 'One'.
APPEND ls_value_set TO lt_value_set.
ls_value_set-value = '02'.
ls_value_set-text = 'Two'.
APPEND ls_value_set TO lt_value_set.
lo_nd_ctx_tab = wd_context->get_child_node( 'DOC_MEASURE' ).
lo_ndinfo_ctx_tab = lo_nd_ctx_tab->get_node_info( ).
lo_ndinfo_ctx_tab->set_attribute_value_set(
name = 'VALEUR_DIFF' value_set = lt_value_set ).
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( 'DOC_MEASURE' ).
lr_nodeinfo = lr_node->get_node_info( ).
lr_nodeinfo->set_attribute_value_set(
EXPORTING
name = 'VALEUR_DIFF'
value_set = lt_valueset
).
Thanks.
Matías.
Hi,
In your code, you are trying to do set_attribute_value_set twice. If you read your code carefully, you are setting the values once using lt_value_set where you have correctly filled the values. But after this, you are again trying using lt_valueset without filling any values. This is why your previous value-list gets overwritten and you see nothing in the dropdown. Remove the following lines in your code and it will work fine.
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( 'DOC_MEASURE' ).
lr_nodeinfo = lr_node->get_node_info( ).
lr_nodeinfo->set_attribute_value_set(
EXPORTING
name = 'VALEUR_DIFF'
value_set = lt_valueset
).
Please get back if you are facing any more issues.
Regards,
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matias,
Your code looks fine, but is this your complete code? I see that the set_data( node_name ) and the bind_table is missing. Have you done the data binding to the context node? Otherwise the dropdown filling code looks fine as it is and it should work.
What is the issue you are facing? Are you getting a dropdown cell editor but with no values filled?
Regards,
Nithya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.