I have an Internal table wherein I have implemented Expansion and collapse. Now I want to sort this table dynamically everytime a new Child node is added to a Father Node. How do I sort it so that the Child nodes are inserted correctly under their corresponding Father Nodes?
I tried using Indexing concept , e.g., insert <structure> into <itab> index lv_ind.
lv_ind = sy-tabix + lines( itab ).
For the First Father Node, the Child nodes are inserted in the correct position but when the Second Father Node is reached( say in position 12 ), then lv_ind gets a wrong value... The Child node should now be inserted in the 13th position but its inserted in lv_ind = sy-tabix + lines( itab ) = 12 + 12 = 24th position.
Please let me know how to go about.
Thanks and regards,