cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting row from table in wda .

Former Member
0 Kudos

Hi Experts,

I am showing the records on the screen in a table .

One of the columns contains the link 'Delete' as a LinkToAction .

I want to delete this record from the table on the

screen when this 'Delete' link is pressed.

Thanks in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vaibhav,

Implement the following code in the action handler for the LinkToAction click event.

Firstly, Get the selected element.

Data : node_material type ref to if_wd_context_node,

elem_material type ref to if_wd_context_element.

call method node_material->get_lead_selection

receiving

element = elem_material

.

Now, delete this element.

call method node_material->remove_element

exporting

element = elem_material

.

Thanks.

Shruti

Former Member
0 Kudos

Hi

Check this code

in the parameters above the method declare an attribute context_element type if_wd_context_element.

DATA lo_nd_rcf_edu_det TYPE REF TO if_wd_context_node.

DATA lo_el_rcf_edu_det TYPE REF TO if_wd_context_element.

DATA ls_rcf_edu_det TYPE wd_this->element_rcf_edu_det.

  • DATA lt_rcf_edu_det TYPE wd_this->elements_rcf_edu_det.

data ls_delete_buffer type rcf_s_cand_education_pl.

data lv_index type i.

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

lo_nd_rcf_edu_det = wd_context->get_child_node( name = wd_this->wdctx_rcf_edu_det ).

  • @TODO handle non existant child

  • IF lo_nd_rcf_edu_det IS INITIAL.

  • ENDIF.

  • get element via lead selection

lo_el_rcf_edu_det = lo_nd_rcf_edu_det->get_element( ).

  • alternative access via index

  • lo_el_rcf_edu_det = lo_nd_rcf_edu_det->get_element( index = 1 ).

  • @TODO handle not set lead selection

IF lo_el_rcf_edu_det IS INITIAL.

ENDIF.

CALL METHOD context_element->get_index

receiving

my_index = lv_index.

CALL METHOD lo_nd_rcf_edu_det->get_element

EXPORTING

index = lv_index

receiving

node_element = lo_el_rcf_edu_det .

CALL METHOD lo_el_rcf_edu_det->get_static_attributes

IMPORTING

static_attributes = ls_rcf_edu_det.

ls_rcf_edu_det-operation = 'D'.

move-corresponding ls_rcf_edu_det to ls_delete_buffer.

append ls_delete_buffer to wd_comp_controller->gt_delete_buffer.

CALL METHOD lo_nd_rcf_edu_det->remove_element

EXPORTING

element = lo_el_rcf_edu_det

  • receiving

  • has_been_removed =

.

regards

chythanya

Former Member
0 Kudos

Define an action handler for the LinkToAction click event. In the event handler, get the element that was selected using the code:

element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

Then, get the reference of your context node using the code wizard (ctrl + F7). Now use the method

node->remove_element( element )

to remove the selected element. The particular row will be deleted.

Regards,

Nithya