cancel
Showing results for 
Search instead for 
Did you mean: 

WebDynPro ABAP: Deleting row in the table while button clicking

Former Member
0 Kudos

Hi

Expert ,

I need to delete the selecting row from the table while i am clicking the button ,

any one can let me know about this one

Thanks & Regards

Sankar.M

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Siva

Check out this link

Former Member
0 Kudos

Hi Sankar,

Anand babu's reply is almost correct but here it only deletes the record in the lead selection.

To delete the selected record in your table get the index of the record.

In the action handler use this code to get the index.

1. First add this parameter in the action handler in the parameter placeholder above the code area.

CONTEXT_ELEMENT TYPE IF_WD_CONTEXT_HANDLER

2. Get the index

DATA V_INDEX LIKE SY-INDEX.

  • Get Selected Row

CALL METHOD CONTEXT_ELEMENT->GET_INDEX

RECEIVING

MY_INDEX = V_INDEX.

3. Get the context element for this index

For example

Node_REPORT_ROLES = wd_Context->get_Child_Node( Name = IF_V_MAIN=>wdctx_REPORTING_ROLES ).

Elem_REPORT_ROLES = Node_REPORT_ROLES->get_Element( INDEX = V_INDEX ).

4. Delete the row

Node_REPORT_ROLES->remove_element( Elem_REPORT_ROLES ).

Please help me if I was able to help you. )

Former Member
0 Kudos

Hi,

user the code below for the button action.

replace the x with your context element name


  DATA lo_nd_x TYPE REF TO if_wd_context_node.
  DATA lo_el_x TYPE REF TO if_wd_context_element.
  DATA ls_x TYPE wd_this->element_x.

  lo_nd_x = wd_context->get_child_node( name = wd_this->wdctx_x ).

* @TODO handle not set lead selection
  IF lo_nd_x IS NOT INITIAL.

* get element via lead selection
  lo_el_x = lo_nd_x->get_element(  ).

* @TODO handle not set lead selection
  IF lo_el_x IS NOT INITIAL.
    lo_nd_x->remove_element( lo_el_x ).
  ENDIF.

By,

Anand Babu R