cancel
Showing results for 
Search instead for 
Did you mean: 

to delete a record of a UI table

Former Member
0 Kudos

Hi,

Please tell me how to delete a record from the UI table in web dynpro abap on click of a button.

Plz reply.

Thanks & Regards,

Raji.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Get the content of Table into a intenal table. Ex : Use this method GET_STATIC_ATTRIBUTES_TABLE of if_wd_context_node.

Get the index of row seleted which is to be deleted. Ex. Use this mehod GET_LEAD_SELECTION_INDEX of if_wd_context_node.

Delet the row from internal table. <Delete statement>

Bind the internal table again with the node. < Use method bind_table of if_wd_context_node.>

Refer this Sample Code :

data i1 type I.

lo_nd_po->get_static_attributes_table( itab ).

i1 = lo_nd_po->get_lead_selection_index( ).

delete itab index i1.

lo_nd_po->bind_table( itab ).

Former Member
0 Kudos

Hi Raji,

You can use REMOVE_ELMENT of the if_wd_context_node to delete an entry from the UI.

For the underlying DB table you can use the above approaches.

Regards,

Lekha.

Former Member
0 Kudos

Done!thanks a lot

Answers (2)

Answers (2)

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Raji,

to delete the record for the table.

the user will first select the record to be deleted and then clicks the button to delete record.

So on the action of that button you can read the selected record using get_static_atributes.

like...

lo_el_prf_exp_cer_detail->get_static_attributes(

IMPORTING

static_attributes = ls_prf_exp_cer_detail ).

so ls_prf_exp_cer_detail holds the record to be deleted.

so the record can be deleted from DB or temp accordingly to your requirement.

Regards,

Priya

Former Member
0 Kudos

In the on action of that button , write code to delete

following sample code wud help u to get the index of the line which u want to delete from ur table



DATA : lo_nd_cn_table TYPE REF TO if_wd_context_node ,
         lo_el_cn_table TYPE REF TO if_wd_context_element ,
         ls_cn_table    TYPE wd_this->element_cn_table.

*   navigate from <CONTEXT> to <CN_TABLE> via lead selection
  lo_nd_cn_table = wd_context->get_child_node(
                   name = wd_this->wdctx_cn_table ).
**    get element via lead selection
  lo_el_cn_table = lo_nd_cn_table->get_lead_selection(  ).
  lo_el_cn_table->get_static_attributes( IMPORTING
             static_attributes = wa_table ).
data lv type I.
DESCRIBE TABLE itab LINES lv.

delete itab where INDEX =  // ur specified index

I hope it wud help u