on 10-20-2008 9:54 AM
Hi Experts,
i am using table ui element to show the uploaded files details like name of the file , user name and date on which the file was uploaded. Bind a node to the table with lead selection intialization and selection mode as multinode.
I have a delete button in table tool bar. i need to delete the selected row.But always the table header is pointing to the first uploaded record and it deletes first then the second file becomes first. So in my next attempt it delete the second record though i have selected 4th or 5th record.
The lead selection doesnot pointing to the selected record.
please help to solve this problem.
Thanks,
Ramanan
answered
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramanan,
Try below code, below code is used to delete multiple selection in a table. Sure this will resolved ur problem.
DATA : lo_node TYPE REF TO if_wd_context_node,
lo_element TYPE REF TO if_wd_context_element,
index type i.
DATA : sets type WDR_CONTEXT_ELEMENT_SET,
wa_sets like LINE OF it_sets.
CALL METHOD LO_NODE->GET_SELECTED_ELEMENTS
EXPORTING
INCLUDING_LEAD_SELECTION = ABAP_TRUE
RECEIVING
SET = sets.
loop at sets into wa_sets.
CALL METHOD WA_SETS->GET_INDEX( RECEIVING MY_INDEX = index ).
lo_element = lo_node->get_element( index = index ).
call method lo_node->remove_element
EXPORTING
element = lo_element.
receiving
has_been_removed =
.
endloop.
Thanks...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramanan,
1) Get the references of all the selected table rows into an internal table.
2) Loop through the above table & delete the rows from the context
3) Get all the present context node data into 1 internal table
4) Re-bind the new internal table to the context
Regards,
Uday
Below is the coding to do the deletion task that you intend to do.
METHOD onactiondelete_selected_rows .
DATA: wd_node TYPE REF TO if_wd_context_node,
lt_node1 TYPE ig_componentcontroller=>elements_node1,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set,
row_number TYPE i VALUE 0.
wd_node = wd_context->get_child_node( name = 'NODE1' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
LOOP AT lt_temp INTO wa_temp.
wd_node->remove_element( EXPORTING element = wa_temp ).
ENDLOOP.
CALL METHOD wd_node->get_static_attributes_table
EXPORTING
from = 1
to = 2147483647
IMPORTING
table = lt_node1.
wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramanan,
If you want to work with multiple row selection in a table then you will have to make use of "Selection" concept. LeadSelection allows you to select only 1 row at a time. Try setting the SelectionMode to "Auto". Also uncheck the, "Initialization Lead Selection" checkbox of the node which you are using to bind to your table. (This helps make the first row as not selected by default.) The below coding helps copy data in between 2 tables. The user first selects multiple records from 1 table using the Selection concept and presses on a toolbar button COPY. I hope this coding would help make you understand the concept.
Regards,
Uday
METHOD onactioncopy_selected_rows .
DATA: wd_node TYPE REF TO if_wd_context_node,
ls_node1 TYPE ig_componentcontroller=>element_node1,
lt_node1 TYPE ig_componentcontroller=>elements_node1,
lt_node2 TYPE ig_componentcontroller=>elements_node2,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
wd_node = wd_context->get_child_node( name = 'NODE1' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
wd_node = wd_context->get_child_node( name = 'NODE2' ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramanan,
Please check your node again.
It will be good if u can share the screenshot of your context node with us.
Regards,
Sumit Oberoi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.