cancel
Showing results for 
Search instead for 
Did you mean: 

add_attribute, set_attribute

Former Member
0 Kudos

Hi

I need your great knowledge.

I have an alv table with a context node created at design time (i want to change this later on maybe...)

now i add an attribute with add_attribute

no problem

i set the value of the attribute

no problem (?)

for checking i get the value of the attribute again.

no problem

but i don't see the value in the alv tree...

or in another way

how can i fill the values of the added attribute with code.

Is there anything spezial i need to to do, for non static attributes?


...
          co_el->get_attribute( exporting name = 'SWITCHF' importing value = value ).
          co_el->set_attribute( name = 'SWITCHF' value = 'X' ).
          co_el->get_attribute( exporting name = 'SWITCHF' importing value = value ).

          node_data->set_attribute( INDEX = 1 VALUE = 'X' name = 'SWITCHF' ).
...

...
  data attr type WDR_CONTEXT_ATTRIBUTE_INFO.
  attr-NAME = 'SWITCHF'.
  attr-DEFAULT_VALUE = ' '.
  attr-TYPE_NAME = 'WDY_BOOLEAN'.
*  attr-IS_STATIC = 'X'.
*  attr-NODE_INFO = node_info.
  node_info->ADD_ATTRIBUTE( attr ).
...

(((is there a way to debug the actual viewed table of the alv?)))

lg

Andreas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

To fill data in an ALV table, you will have to fill your data in an internal table and bind it to your node.


l_node->bind_table( internal table name ).

Former Member
0 Kudos

Good point.

But i don't have problems with getting data in the table generally. The attributes i have created at disign time are filled with values.

Former Member
0 Kudos

my solution at the moment is to create the whole conntext by hand

something like this maybe if somebody else has a similiar problem. I only copy part of my solution to give a hint:


...
  data comp_tab type abap_component_tab.
  data comp type abap_componentdescr.
...
loop at lt_cust into lw_cust. "this could be the ddict info from the original stuct. in my case this is a customizing table to change the order of my columns, because i don't like to (or the user) to change the context node...)
      data tem type string.
      concatenate dso_tabname '-' lw_cust-iobjnm into tem.
      comp-name = lw_cust-iobjnm.
      comp-type ?= CL_ABAP_DATADESCR=>DESCRIBE_BY_NAME( tem ).
      append comp to comp_tab.
endoop.

...
    comp-name       = 'INDEX'.
    comp-type ?= CL_ABAP_DATADESCR=>DESCRIBE_BY_NAME( 'I' ).
    append comp to comp_tab.

    comp-name       = 'CHANGEABLE'.
    comp-type ?= CL_ABAP_DATADESCR=>DESCRIBE_BY_NAME( 'WDY_BOOLEAN' ).
    append comp to comp_tab.

   data rtti TYPE REF TO CL_ABAP_STRUCTDESCR.
   rtti ?= CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = comp_tab ).

    node_info->add_new_child_node(
            name                   = 'DATA2'
            STATIC_ELEMENT_RTTI = rtti ).
...

while i am writing this, there are so many questions, but this should be of use for somebody else even

may i get points for this;-)