cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic node creation from RTTI structure and dynamic mapping

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

I havent tried add_mapped_child_node but dynamically creating node using rtti.

providing struct_type was enough. It created the node with the structure in it.

Former Member
0 Kudos

Problem solved, the path was not good :

* 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.
  append 'COMPONENTCONTROLLER' to stru_mapping_info-path.
  append 'MY_TABLE' to stru_mapping_info-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
      .

Regards,

Pierre