on 11-21-2008 10:44 AM
Hi,
i set a dropdown cell editor to alv but i didn't set the values of dropdown list.
i created a node that in node of alv for values of my dropdown list and filled that node.
lr_column = lr_config->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN(
'PK08').
CREATE OBJECT lr_dropdownbyidx
EXPORTING
selected_key_fieldname = 'PK08'
.
CALL METHOD lr_dropdownbyidx->set_valueset_fieldname
EXPORTING
value = 'PK08T'
.
lr_column->set_cell_editor( lr_dropdownbyidx ).
PK08 is an attribute in node of alv. PK08T is a node in node of alv.
i tried to fill values of dropdown list with this method but i got a dump that ;
Field symbol has not yet been assigned
has somebody know how to set values to dropdown list?
Can somebody help me pls?
Thanks.
solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this complete code fragment below which converts 2 columns to dropdowns:
METHOD WDDOMODIFYVIEW .
DATA:
lr_alv_usage TYPE REF TO if_wd_component_usage,
lr_if_controller TYPE REF TO iwci_salv_wd_table,
lr_config TYPE REF TO cl_salv_wd_config_table,
lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lt_columns TYPE salv_wd_t_column_ref,
lr_link TYPE REF TO cl_salv_wd_uie_link_to_action,
lr_checkbox TYPE REF TO cl_salv_wd_uie_checkbox,
lr_image TYPE REF TO cl_salv_wd_uie_image,
lr_dropdown TYPE REF TO CL_SALV_WD_UIE_DROPDOWN_BY_KEY.
FIELD-SYMBOLS
<fs_column> LIKE LINE OF lt_columns.
* Instantiate the ALV Component
lr_alv_usage = wd_this->wd_cpuse_alv( ).
IF lr_alv_usage->has_active_component( ) IS INITIAL.
lr_alv_usage->create_component( ).
ENDIF.
* Get reference to model
lr_if_controller = wd_this->wd_cpifc_alv( ).
lr_config = lr_if_controller->get_model( ).
*** To get the dropdowns displayed you need to set the table to editable by using below statement
lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).
* Set the UI elements.
lr_column_settings ?= lr_config.
lt_columns = lr_column_settings->get_columns( ).
" Here you can use the below code to fill up the dropdown with values or else
" you can directly type the context attribute based on a domain with fixed values
" I have used the latter approach & hence commented out the below coding
* data: lr_node_info type ref to if_wd_context_node_info,
* lr_node type ref to if_wd_context_node,
* wa_value_set type wdr_context_attr_value,
* lt_value_set type table of wdr_context_attr_value.
*
* lr_node = wd_context->get_child_node( name = 'NODE' ).
* lr_node_info = lr_node->get_node_info( ).
* wa_value_set-value = '1'.
* wa_value_set-text = 'One'.
* insert wa_value_set into table lt_value_set.
*
* wa_value_set-value = '2'.
* wa_value_set-text = 'Two'.
* insert wa_value_set into table lt_value_set.
*
* wa_value_set-value = '3'.
* wa_value_set-text = 'Three'.
* insert wa_value_set into table lt_value_set.
*
* lr_node_info->set_attribute_value_set( name = 'TEMP'
* value_set = lt_value_set ).
**********************************************************************************
LOOP AT lt_columns ASSIGNING <fs_column>.
IF <fs_column>-id = 'CARRID'.
CREATE OBJECT lr_link.
lr_link->set_text_fieldname( <fs_column>-id ).
<fs_column>-r_column->set_cell_editor( lr_link ).
ENDIF.
IF <fs_column>-id = 'TEMP'.
CREATE OBJECT lr_dropdown
EXPORTING
selected_key_fieldname = 'TEMP'.
<fs_column>-r_column->set_cell_editor( lr_dropdown ).
ENDIF.
IF <fs_column>-id = 'TEMP_NEW'.
CREATE OBJECT lr_dropdown
EXPORTING
selected_key_fieldname = 'TEMP_NEW'.
<fs_column>-r_column->set_cell_editor( lr_dropdown ).
ENDIF.
ENDLOOP.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Uday,
data: lr_node_info type ref to if_wd_context_node_info,
lr_node type ref to if_wd_context_node,
wa_value_set type wdr_context_attr_value,
lt_value_set type table of wdr_context_attr_value.
lr_node = wd_context->get_child_node( name = 'KYP' ).
lr_node_info = lr_node->get_node_info( ).
wa_value_set-value = '1'.
wa_value_set-text = 'One'.
insert wa_value_set into table lt_value_set.
wa_value_set-value = '2'.
wa_value_set-text = 'Two'.
insert wa_value_set into table lt_value_set.
wa_value_set-value = '3'.
wa_value_set-text = 'Three'.
insert wa_value_set into table lt_value_set.
lr_node_info->set_attribute_value_set( name = 'PK08'
value_set = lt_value_set ).
lr_column = lr_config->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN(
'PK08').
CREATE OBJECT lr_dropdownbyidx
EXPORTING
selected_key_fieldname = 'PK08'
.
lr_column->set_cell_editor( lr_dropdownbyidx ).
Here, KYP is a node of my ALV, and PK08 is an attribute of KYP and it is dropdown.
have i forgetten something to fill up the PK08 which is dropdown?
Thanks again.
Hi Nurullah,
Suppose you are binding a context node by name NODE to your ALV & within this node you have an attribute by name TEMP which would get bound to the column which you want to display as ALV. Then you can set the value set for this TEMP in 2 ways:
1) By typing this attribute based on a domain with fixed values. Your drop down would get automatically filled with the single values which you had maintained in the "Value Range" tab of the domain.
2) Just attach a value set to this context node using the set_attribute_value_set method. Consider the code fragment below:
data: lr_node_info type ref to if_wd_context_node_info,
lr_node type ref to if_wd_context_node,
wa_value_set type wdr_context_attr_value,
lt_value_set type table of wdr_context_attr_value.
lr_node = wd_context->get_child_node( name = 'NODE' ).
lr_node_info = lr_node->get_node_info( ).
wa_value_set-value = '1'.
wa_value_set-text = 'One'.
insert wa_value_set into table lt_value_set.
wa_value_set-value = '2'.
wa_value_set-text = 'Two'.
insert wa_value_set into table lt_value_set.
wa_value_set-value = '3'.
wa_value_set-text = 'Three'.
insert wa_value_set into table lt_value_set.
lr_node_info->set_attribute_value_set( name = 'TEMP'
value_set = lt_value_set ).
Hope this helps resolve your problem.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.