Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to write nested nodes in context


I have two nodes in my context:

node "client" (0..n) with one attribute "name" and one node nested "car" (0..n) that has one attribute "l_plate".


client (0..n)

car (0..n)

How do I write data to this context?

Do I have to create an element car first, so bind it to a element client?


Former Member

Jorge, if the context clients-node does already contain all the elements, the next step could be

to loop over these clients-elements and to get the cars-node for every client-element and to bind the

cars-table to the cars-node.

  data lr_client_node type ref to if_wd_context_node.
  data lt_client_elem type wdr_context_element_set.
  data lr_client_elem type ref to if_wd_context_element.

  data lr_car_node type ref to if_wd_context_node.
* get all client elements
  lt_client_elem = lr_client_node->get_elements( ).

* for every client element in the client node
  loop at lt_client_elem into lr_client_elem.

* possibly we need a client id to find the right cars
        name   = 'CLIENT_ID'
        value  = lv_client_id

    lr_car_node = lr_client_elem->get_child_node( name = if_componentcontroller=>wdctx_car ).
* some more coding to 
*  get the cars
*  bind the cars to this node


Hope this works as I don't have a system right here to check

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question