on 03-20-2008 2:19 PM
Hi Experts,
I would like to delete multiple line items from my table in Web dynpro for ABAP.
I could able to delete single line item only.
How to delete multiple line items???
FYI... I'm using foll. code to delete single row
lo_el_flight_list = lo_nd_flight_list->get_element( ).
call method lo_nd_flight_list->remove_element
exporting
element = lo_el_flight_list.
Valuable answers will be rewarded.
Thanks...
hi router....
what you can do is......
once the delete button is clicked......
make use of the method, get_selected_elements in the interface if_wd_context_node....
get all the rows, delete it from internal table and bind it again to the table.
---regards,
alex b justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Justin,
I added the following code
data : sets type WDR_CONTEXT_ELEMENT_SET,
wa like LINE OF sets.
call method lo_nd_flight_list->get_selected_elements
receiving
set = sets.
loop at sets into wa.
lo_el_flight_list = lo_nd_flight_list->get_element( ).
call method lo_nd_flight_list->remove_element
exporting
element = lo_el_flight_list.
endloop.
I could loop it. But I couldnt able to delete.
Can you correct me if i'm wrong in the code.
Thanks...
Hello Router,
you can get the index for each element returned by get_selected_elements() by calling get_index() at the element itself.
Btw: Binding the data again is only recommended for small data. Moreover, you will lose the content of sub nodes by doing so as well as any additional data maintained by the web dynpro runtime.
Best regards,
Thomas
Hi Router,
The mistake in the code snippet you attached is that you are passing the lead selected(Last selected in case of multiple selections) recore every time by doing get_element.
Do the following and it should work.
loop at sets into wa.
Call method lo_nd_flight_list->remove_element
exporting element = wa.
endloop.
sets is a table type of WDR_CONTEXT_ELEMENT_SET with line reference IF_WD_CONTEXT_ELEMENT.
and the export parameter wa is also of type IF_WD_CONTEXT_ELEMENT. .
The sets holds instances of all the elements selected. So when read into wa we hold the reference of the indivudial element which we are trying to remove. So pass that reference of the element to the the exporting parameter 'element'.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.