Skip to Content
0
Former Member
Apr 28, 2009 at 10:19 AM

deleting a row in a table control

62 Views

HI all,

I've table control with option as "delete row".

if i create 3 rows and i want to delete the third record but first record is getting deleted.

pls have look on the code... and suggest me...

method ONACTIONA_DELETE_ROW .

  • Deleting a empty line from the node

DATA lo_nd_n_material TYPE REF TO if_wd_context_node.

DATA lo_el_n_material TYPE REF TO if_wd_context_element.

DATA ls_n_material TYPE wd_this->element_n_material.

DATA item_no TYPE zmatreq-zitem.

DATA lt_n_material TYPE wd_this->elements_n_material.

  • navigate from <CONTEXT> to <N_MATERIAL> via lead selection

lo_nd_n_material = wd_context->get_child_node( name = wd_this->wdctx_n_material ).

  • get element via lead selection

lo_el_n_material = lo_nd_n_material->get_element( ).

  • get all declared attributes

lo_nd_n_material->get_static_attributes_table(

importing

table = lt_n_material ).

loop at lt_n_material into ls_n_material.

  • if ls_n_material-a_req_type eq space or ls_n_material-a_matgrp eq space

  • or ls_n_material-a_dev_centre eq space.

item_no = ls_n_material-itemno.

DELETE TABLE lt_n_material from ls_n_material.

exit.

endif.

endloop.

lo_nd_n_material->bind_table( lt_n_material ).

  • Deleting a empty line from the node

endmethod.

regards

Suprith