Skip to Content

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

Dynamic node creation from RTTI structure and dynamic mapping


I'd like to create a dynamic node in my component controller then map this node to a node in my view and bind it to a dynamic table.

I create the dynamic node in my component controller using the add_new_child_node method :

CALL METHOD root_node_info->add_new_child_node
      name                    = 'MY_TABLE'
      static_element_rtti     = struct_type
      is_static               = ABAP_true
      child_node_info              = node_info

Then I use the add_new_mapped_child_node method to map the node in the view :

* Map the context node dynamically
  insert wa_path into table tab_mapping_path.
  stru_mapping_info-controller = 'COMPONENTCONTROLLER'.
  stru_mapping_info-path = tab_mapping_path.

  lo_node_info = wd_context->get_node_info( ).

  CALL METHOD lo_node_info->add_new_mapped_child_node
      child_name      = 'MY_TABLE'
      mapping_info    = stru_mapping_info
      child_node_info = lo_dyn_node_info

The child node is created in my view context but it doesn't have any attribute or static element RTTI.

Do I have to add each attribute with the add_attribute method and then the add_new_mapped_child_node method will copy them over?



Former Member
Not what you were looking for? View more on this topic or Ask a question