cancel
Showing results for 
Search instead for 
Did you mean: 

how to select multiple row of table using check box?

Former Member
0 Kudos

hi,

i am having table on view having first field as checkbox. what i want, when i click on checkboxes in multiple rows, and i click on any button i need to use those content to next view...

my problem is if i select only one row , i can use onlead select property of table..but when i select multiple rows through check box how should i read contents of table....?

Plz solve it.

Thanks,

Saurin Shah

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hello Saurin,

You are right using LeadSelection you can select only 1 row at a time. You will have to make use of Selection for achieving this. First you will have to change the selection mode of the table to multiple & also change the selection property for the related context to 0..n . Please find a code extract which might help you. (However this facility is only available from SP 14.) The main part is using the set_selected method of if_wd_context_node.

data: node_zcourse_details type ref to if_wd_context_node,
         node_course_assign type ref to if_wd_context_node,
         elem_course_assign type ref to if_wd_context_element,
         stru_course_assign type if_v_details=>element_course_assign ,
         item_popin_selected like stru_course_assign-popin_selected.

"     navigate from <CONTEXT> to <ZCOURSE_DETAILS> via lead selection

node_zcourse_details = wd_context->get_child_node( name = if_v_details=>wdctx_zcourse_details ).

"     navigate from <ZCOURSE_DETAILS> to <COURSE_ASSIGN> via lead selection

node_course_assign = node_zcourse_details->get_child_node( name = if_v_details=>wdctx_course_assign ).

"     @TODO handle not set lead selection

if ( node_course_assign is initial ). 
exit.
endif.

data elem_set type wdr_context_element_set.
field-symbols <wa_elem> like line of elem_set.
elem_set = node_course_assign->get_elements( ).

loop at elem_set assigning <wa_elem>.
   <wa_elem>->set_selected( TRUE OR FALSE ). " Supply either TRUE/FALSE in here
endloop.

Former Member
0 Kudos

hi,

Thanks for help.

As u asked me

1) i set up the table SELECTION MODE property to MULTI and

2) i changed the context node SELECTION property as 0...N which is bind to table ,

i execute application.. u know at the at the end of table it shows no. of rows gets filled up in table , it is right. but data is not there in table.

when i debug and check it , bapi gives right output and it binds to context node even, bt its not displayed on screen.

i think have i made something wrong in SELECTION property?

Plz solve this.

Thanks,

saurin shah

uday_gubbala2
Active Contributor
0 Kudos

Hi Saurin,

Not sure as to where you might be going wrong. I will try explain the procedure in a bit more detail. Suppose you want to display the data of VBAK in a table.

1) Create a context node NODE1. (cardinality 0..n, selection 0..n, uncheck initialise lead selection checkbox)

2) Bind the dataSource property of the table ui element to this node NODE1. Select the cell editor as textview and the standard property as text.

3) Check the rowSelectable checkbox in the table properties.

Below is the coding that I use for selecting all the lines of the table control.

METHOD onactiondeselect_all_rows .
  DATA: wd_node TYPE REF TO if_wd_context_node,
        lines_count TYPE i VALUE 0.

  wd_node = wd_context->get_child_node( name = 'NODE1' ).
  CALL METHOD wd_node->get_element_count
    RECEIVING
      count = lines_count.
  DO lines_count TIMES.
    wd_node->set_selected( flag  = ''
                           index = sy-index ).
  ENDDO.
ENDMETHOD.

Former Member
0 Kudos

hi,

as u said i did it, it works. bt in table doesnt show any data. it shows at the end of table, that these many rows gets filled up,bt its not there on grid.. any property i need to set or what?

thanks,

saurin shah

Answers (1)

Answers (1)

former_member185029
Active Contributor
0 Kudos

Hi,

There is a property of Table UI called isMultiSelected(int position)

It returns true is the row at that position is selected.

-Ashutosh