Skip to Content

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

Subnode table webdynpro abap

Hi all ,

I ve declared a node1 (0..n) in the controller in which i ve involved an other sunode (0..n) and others attributes (1..1).

node1:

-


| node2 (0..n):

-


| attributes (1..1)

-


| attribute_1 (1..1)

-


| attribute_2 (1..1)

-


| Other attributes ... (1..1)

when i add one record_1 on the node in orther to be displayed on a table it's work fine, but when i try to add an other record ->

the sub node of record_1 is lost.

I use this code to add a record to the display table:


 " bind table with only attributes (1..1) filled

bind_table( new_items = lt_node1 set_initial_elements = abap_true ).

  DATA index_table TYPE i.

  DESCRIBE TABLE lt_node1 LINES index_table.

  DATA lo_nd_node2 TYPE REF TO if_wd_context_node.

  DATA lt_node2 TYPE wd_this->elements_node2.

  lo_nd_node2 = wd_context->path_get_node( path = `NODE1.NODE2` ).

  lr_element = lo_nd_node1->get_element( index_table ).

  lo_nd_node2 = lr_element->get_child_node( 'NODE2' ).

" Bind the subnode node2  of the current index of the table node1

  lo_nd_semaines->bind_table( new_items = lt_node2 set_initial_elements = abap_true  ).
  

Any other ways of how to bind subnodes (parent and child nodes) ?

Best regards

Former Member
Former Member replied

HI,

After getting the lement just use the REMOVE_ELEMENT method of IF_WD_CONTEXT_NODE.

"Get the selectioned line
 
  lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
 
  lo_el_node1 = lo_nd_node1->get_element( ).
 
   lo_nd_node1->remove_element(   lo_el_node1 ).

Regards,

Madhu.

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