cancel
Showing results for 
Search instead for 
Did you mean: 

Delete selected elements??

siongchao_ng
Contributor
0 Kudos

Hi all,

How do I delete selected elements in a node? Let say I want to delete element index 2. How do I do it? Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

saravanan_narayanan
Active Contributor
0 Kudos

you can do this be calling node->get_element( index ) and then call node->remove_element( seleced_element ).

Code:

data: lo_el_selected_element type ref to if_wd_context_element.

lo_el_selected_element = node->get_element( 2 ).

node->remove_element ( lo_el_selected_element ).

Answers (2)

Answers (2)

former_member184578
Active Contributor
0 Kudos

Hi.,

Get the selected Element or selected Index.,

now read the internal table in node using get_static_attributes_table method.,

loop the internal table

count = count + 1.

if count = selected index.

esle.

append internal table to final internal table (itab-fin).

endif.

endloop.

now bind_table( itab_fin ). " now the selected element will not appear in the node.

you can also use remove_element method to remove selected elements

hope this helps u..

Thanks & Regards,

Kiran

former_member199125
Active Contributor
0 Kudos

first get the required element into element variable..

lo_el_itab = lo_nd_itab->get_element( index = 2 ).

then remove that element from node.

Lo_nd_itab->remove_element( lo_el_itab ).

Regards

Srinivas