2 Replies Latest reply: Jun 7, 2011 4:27 PM by Pierre Dominique RSS

Dynamic node creation from RTTI structure and dynamic mapping

Pierre Dominique
Currently Being Moderated

Hi,

 

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
    EXPORTING
      name                    = 'MY_TABLE'
      static_element_rtti     = struct_type
      is_static               = ABAP_true
    RECEIVING
      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
  wa_path = 'COMPONENTCONTROLLER.MY_TABLE'.
  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
    EXPORTING
      child_name      = 'MY_TABLE'
      mapping_info    = stru_mapping_info
    receiving
      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?

 

Regards,

 

Pierre

Actions