Expand tree in WebDynpro ABAP application


Currently I am working on a WDA application which contains a UI ELEMENT TREE. The tree is generated dynamically at runtime.

I was guided by the example of SAP "WDT_TREE". After generating the tree looks like this:

   | __ NODE1
           | __ LEAF1
           | __ LEAF2
           | __ NODE2
                | __ LEAF3
           | __ Node3
                | __ LEAF4
                | __ LEAF5
                | __ LEAF6

Now I have bound the "expanded" property of the node to a context element and execute the following action in the WDDOINIT:

* Fill tables with the structure of the tree
  fill_foldertable( ).
  fill_filetable( ).

  lr_current_node    = wd_context->get_child_node( 'FOLDER' ).
  lr_current_element = lr_current_node->create_element( ).
  lr_current_node->bind_element( lr_current_element ).
  lr_current_node->set_lead_selection( lr_current_element ).

  lr_current_element->set_attribute( name = 'TEXT' value = 'Products' ).
 lr_current_element->set_attribute( name = 'IS_EXPANDED' value = 'X' ).

* Create the root node
      cur_element = lr_current_element
      parent_key  = 'Categories' ).

Now the tree is expanded, but i can't see EAF1 and LEAF2. I get them only by clicking again on node1.

Any ideas?


  • SAP Employee

Hello Juergen,

You need to maintain the Parent ID of the child nodes Leaf 1 and Leaf2 and expanded propert at child node level.

if this doesnt help, Kindly share your code by which you generate the data for the context.


Anurag Chopra

0 View this answer in context

Helpful Answer