on 05-31-2013 1:14 PM
Hi Guys,
I am triying to set dynamically two attributes that I have loaded dynamically. If I set them manually I can get the values, but when I want to set a value, my ALV doesn´t show this chage and the context contain these values but only for dynamic fields. When I use static attributes I can modify without problems.
How could I set these dynamic values like static ones?
Thanks,
Sergio.
Are U saying that u have a dynamic ALV , and u are setting the attributes of the cell dynamically but when u have the value in that cell the attributes are not working .
I am not clear with ur question . Can u explain it ?
Regards ,
Suvendu Chakraborty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have en structutre that I increase dynamically and show in my ALV. These new fields are booleans, so they appear like checkboxes. When I check them I could get they corresponding value "abap_true". The problem that I have is when I set one on the code with set_attribute( name= 'Field1' value="abap_true") then they appear unchecked. An example. I have the following entity:
Then I add dynamically a boolean variable
Until this step the ALV show correctly a table with 4 columns and "single" appears like a checkbox and I can check or uncheck it and then I can get its corresponding value "X" or space.
The problem is when I try to set this value on the code. I assign to the context but the ALV doesn´t refresh correctly. If I debbug I have this value assigned to the field but I can´t see it in the ALV.
Kind regards,
Sergio.
Try to check the data type of the checkbox field . Is the data type of the checkbox field in the ALV is correct?
After getting all the components for the ALV in structure change the data type as follows :
LOOP AT it_component INTO wa_component.
Suvendu Chakraborty
|
Hello,
This is a documented limitation of the ALV. It does not support Dynamic Attributes and static attribute at the same time.
Instead of using dynamic attributes, consider instead dynmically generating the entire context node. Using the RTTS you can build a dynamic type that is a combination of all the fields you need. You can then use this dynamic data type as the source of the context and all the attributes will be consider static.
For this you can use..
DATA:
rootnode_info TYPE REF TO if_wd_context_node_info,
dyn_node TYPE REF TO if_wd_context_node,
tabname_node TYPE REF TO if_wd_context_node,
struct_type TYPE REF TO cl_abap_structdescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
comp LIKE LINE OF comp_tab.
comp-name = 'FLD1'.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
APPEND comp TO comp_tab.
comp-name = 'FLD2'.
comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ).
APPEND comp TO comp_tab.
*Code for getting node info of root node
rootnode_info = wd_context->get_node_info( ).
*Code for creating a new node with structure defined in comp_tab
struct_type = cl_abap_structdescr=>create( comp_tab ).
rootnode_info = rootnode_info->add_new_child_node(
name = 'NEW_NODE'
is_mandatory = abap_true
is_multiple = abap_true
static_element_rtti = struct_type
is_static = abap_false
).
dyn_node = wd_context->get_child_node( name = 'NEW_NODE' ).
And in the end use set_data of interface controller
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_alv( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
lo_interfacecontroller->set_data(
* only_if_new_descr = " wdy_boolean
"r_node_data =
dyn_node " ref to if_wd_context_node
).
I hope this helps you....
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.