on 05-24-2010 2:40 PM
Hi ,
I have created an ALV having a dynamic context structure.
My problem is that im not able to change the properties of the ALV to editable using the following code.
*-- Get an instance of the ALV configuration Model -
lo_interfacecontroller = wd_this->wd_cpifc_alv_dynamic( ).
data lv_value type ref to cl_salv_wd_config_table.
lv_value = lo_interfacecontroller->get_model(
).
*-- Making the ALV columns editable -
data : lo_column type ref to cl_salv_wd_column,
lif_column_settings type ref to if_salv_wd_column_settings,
lo_input_field type ref to cl_salv_wd_uie_input_field.
data : lt_columns type salv_wd_t_column_ref.
field-symbols : <ls_columns> like line of lt_columns.
lif_column_settings ?= lv_value.
lt_columns = lif_column_settings->get_columns( ).
loop at lt_columns assigning <ls_columns>.
create object lo_input_field
exporting
value_fieldname = <ls_columns>-id.
<ls_columns>-r_column->set_cell_editor( lo_input_field ).
endloop.
*-- Making the ALV editable -
data : lif_table_settings type ref to if_salv_wd_table_settings.
lif_table_settings ?= lv_value.
lif_table_settings->set_read_only( abap_false ).
I have created the dynamic context by creating a node and adding attributes to it at runtime.
The weird part is that , if i create a dynamic context by adding the attributes to a structure description(cl_abap_structdescr) object and pass it to the 'statis_element_rtti' parameter , the code works fine and the ALV is editable.
But my requirement does not allow me to use a structure description object.
I have to add the attributes at runtime after adding the node.
Please suggest a solution.
Regards,
Newton.
The ALV does not support dynamic attributes. It is listed in the online help:
● All the attributes are static, not dynamic.
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/42/b9ea094f4a3118e10000000a1553f7/frameset.htm
You will need the structure description RTTI in order for this to work with the ALV. You can just create a dynamic structure; you don't need a static DDic one. Just fill a component table - comp_tab type cl_abap_structdescr=>component_table,
comp-name = `Test`.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ). "or whatever type you want to use
struct_type = cl_abap_structdescr=>create( comp_tab ).
append comp to comp_tab.
dyn_node_info = rootnode_info->add_new_child_node(
name = 'MDM_DATA'
is_mandatory = abap_false
is_mandatory_selection = abap_false
static_element_rtti = struct_type
is_multiple = abap_true
is_static = abap_false ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot Thomas.
I used the type as 'STRING' and my issue was solved.
Regards,
Newton.
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.