Hi,
i have one node which is built dynamically with five attributes, when i use this node to pass data to alv using set_data method of alv interface controller it is not working, if i pass other node which is created statically it is working.
so what i can infer from this is set_data takes only static attributes not the dynamic attributes, what i am trying to create is i am assigning static attributes to this dynamically created node by creating internal table dynamically using (dynamic)attributes of this node.
so when i use set_static_attributes method, it is showing dump at this point ( from st22 )
1 method if_wd_context_element~set_static_attributes.
2
3 data: client_component type ref to cl_wdr_client_component,
4 l_name type string.
5
6 field-symbols:
7 <fs> type data,
8 <component> like line of me->node_info->static_element_rtti->components.
9
10 if me->is_finalized = abap_true or me->is_static_finalized = abap_true.
11 me->_temp_buffer = me->if_wd_context_element~get_path( ).
12 raise exception type cx_wd_context exporting textid = cx_wd_context=>finalized element_n
13 endif.
14
15 assign me->static_attributes->* to <fs>.
16 if static_attributes is supplied.
>>>> move-corresponding static_attributes to <fs>.
18 else.
19 clear <fs>.
20 endif.
below is the code snippet i am using
lr_table_result = wd_context->get_child_node( 'RESULT_TABLE' ).
lr_node_info = lr_table_result->get_node_info( ).
lt_attributes_info = lr_node_info->get_attributes( ).
Build dynamic internal table
LOOP AT lt_attributes_info INTO ls_attributes_info.
CLEAR: ls_comp.
ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_attributes_info-reference_field ).
ls_comp-name = ls_attributes_info-name.
APPEND ls_comp TO lt_components.
ENDLOOP.
DESCRIBE TABLE lt_components LINES lv_lines.
Create dynamic structure and table
lr_sdescr_new = cl_abap_structdescr=>create( lt_components ).
lr_tdescr = cl_abap_tabledescr=>create( lr_sdescr_new ).
" Create data refence followed by table creation
CREATE DATA lr_handle TYPE HANDLE lr_sdescr_new.
ASSIGN lr_handle->* TO <ls_wa>.
Read dynamic attributes and create static attributes
because method set_data will not work with dynamic attributes
Get all elements
lt_elements = lr_table_result->get_elements( ).
LOOP AT lt_elements INTO lr_element.
for each element get the attribute values
LOOP AT lt_components INTO ls_comp.
lv_tabix = sy-tabix.
ASSIGN COMPONENT lv_tabix OF STRUCTURE <ls_wa> TO <lv_fname>.
lr_element->get_attribute( EXPORTING name = ls_comp-name
IMPORTING value = <lv_fname> ).
ENDLOOP.
lr_element->set_static_attributes( <ls_wa> ).
ENDLOOP.
how can i assing the static attributes?? is it not possible??