cancel
Showing results for 
Search instead for 
Did you mean: 

WDA: How to Insert a new line into a treebykey table?

Former Member
0 Kudos

Dear colleagues,

I want to insert a new line into a treebykey table after a selected line, is there any good suggestion to do this, or example?

I found there is a method 'GET_TABLE_TREE_LEAD_SELECTION' in 'CL_WD_DYNAMIC_TOOL', but it's just for treebynesting.

Then, I try to use the event 'OnLeadSelect' of the table, but I am not clear about how the parameter of 'new_row_element' and 'old_row_element' should be used.

Thank you.

Swee Hu

Accepted Solutions (1)

Accepted Solutions (1)

thomas_szcs
Active Contributor
0 Kudos

Hi Swee,

You can get all selected elements of a context node by calling method GET_SELECTED_ELEMENTS of the context node (interface IF_WD_CONTEXT_NODE). If you need to leadSelection you can use method get_lead_selection (or get_lead_selection_index in case you are only interested in the position of the leadSelection in the table). In case of the *byKey tree-table just insert a new context element at the desired position and make sure that the parent key and key attributes are properly set. Otherwise, the new element wont appear at the proper level. The table renderer automatically calculates the hierarchy depending on the existing key/parent key values of all elements in that "flat structure".

Kind regards,

Thomas

Answers (0)