cancel
Showing results for 
Search instead for 
Did you mean: 

Delete Table Row with Dropdown By Index UI Control

ged_hurst
Participant
0 Kudos

Hi there,

I need to delete the selected row from a table.

The code I've writte is:


 lo_nd_po_items = wd_context->get_child_node( name = wd_this->wdctx_po_items ).
  lo_nd_po_items->get_static_attributes_table( IMPORTING table = lt_po_items ).
  lo_nd_po_items->get_static_attributes( IMPORTING static_attributes = ls_el_po_items  ).

  delete lt_po_items where ebelp = ls_el_po_items-ebelp.
  lo_nd_po_items->bind_table( lt_po_items ).

which works okay but it resets the selection made by the user for the DropDowbByIndex UI Controls arranged on all of the Table rows. Apart from this the deletion works fine.

Any ideas as to why this is happening?

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

saravanan_narayanan
Active Contributor
0 Kudos

method lo_nd_po_items->bind_table( lt_po_items ) will invalidate the node and creates new elements for the entries in lt_po_items. this is the reason for user selection getting reset.

for deleting the table rows, first get the selected element via lo_nd_po_items->get_element and then call lo_nd_po_items->remove_element

ged_hurst
Participant
0 Kudos

Thank you.

Regards

former_member199125
Active Contributor
0 Kudos

its happening because, once you delete the element,again you are binding the values.So it will reset the values.

If you want to main same values in table.

delete the element from node by using below statement...

lo_nd_nodename->remove_element( ' = ls_el_po_items ).

Regards

Srinivas