cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Row Selection in Table list

Former Member
0 Kudos

Hi All,

Currently in our scenorio, we are able to select only one row at a time from the table list, but we need to select multiple row at a time.

Even we have tried to select multi row using CTRL key but if we select another row previous selection got removed.

Kindly suggest where we need to make modification.

Thank you,

Cha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

In the method DO_INIT_CONTEXT of your table view controller, you have to set the selection mode of your table context.

Do init context code:

me->typed_context->ztablecontext->set_selection_mode(
    iv_selection_mode = cl_bsp_wd_context_node_tv=>selmode_multi ).

View code:

<chtmlb:configTable ... selectionMode = "<%= ztablecontext->selection_mode %>" ... />

Hope it helps.

Regards.

Isaac

Former Member
0 Kudos

Hi Issac,

Thank you,

Now able to select multiple rows. Now task is copy line item from one oreder to another order. After select mutlple now i select button to copy. It's copy only one line item not all selected line items. Please suggest how to do this.

Thank you,

Cha

Edited by: Chabalan on Oct 25, 2011 5:47 PM

Former Member
0 Kudos

Hi,

Use the same logic to copy one row, to copy all selected rows in the copy event.

To get the selected rows:

  DATA:
    lr_marked TYPE REF TO if_bol_bo_col,
    lr_entity TYPE REF TO if_bol_bo_property_access.

* Get selected lines

  lr_marked = me->typed_context->ztablecontext->collection_wrapper->get_marked( ).
  IF lr_marked IS BOUND.

*   Process selected lines

    lr_entity ?= lr_marked->get_first( ).
    WHILE lr_entity IS BOUND.
      ...
      lr_entity ?= lr_marked->get_next( ).
    ENDWHILE.
    
  ENDIF.

Regards.

Isaac

Former Member
0 Kudos

Hi Issac,

Thank you for your information.

"get_marked" doesn't have the data.

But if we look at UI then both row in selection. Please suggest.

Thank you,

Cha

Former Member
0 Kudos

Hi,

Try using iterator.

  DATA:
    lr_iterator TYPE REF TO if_bol_bo_col_iterator,
    lr_marked   TYPE REF TO if_bol_bo_col,
    lr_entity   TYPE REF TO if_bol_bo_property_access.
 
* Get selected lines
  lr_iterator = me->typed_context->ztablecontext->collection_wrapper->get_iterator( ).
  CHECK lr_iterator IS BOUND.
  lr_marked = lr_iterator->get_marked( ).
  ...

Regards.

Isaac

Former Member
0 Kudos

Hi Issac,

In Debug at the method of "EH_onrowselection", "Multi_Select" variable is empty. So marked row is not added to the enity list. Even if i use "Get_marked" method able to get the instance but inside entity is empty.

In "EH_onrowselection" method below code is there

CREATE OBJECT lr_col TYPE cl_crm_bol_bo_col.

In this BOL class attribute " multi select" is empty.

IF_BOL_BO_COL~MULTI_SELECT

As well i have added below code to set set multi select at both method of view controller class

DO_INIT_CONTEXT & INIT Method. But still multi select is active in some place and not in some place.

typed_context->admini->set_selection_mode(

iv_selection_mode = cl_bsp_wd_context_node_tv=>selmode_multi ).

Component : ICCMP_BT_SLO

View : SlO1Cart

Please suggest where is the issue.

Thank you,

Cha

Former Member
0 Kudos

Thank you for all your support. Issue solved.

Former Member
0 Kudos

Balan,

I have a Search Result View which allows users to select multiple rows. To process, user clicks the custom button "Submit" added on the Tool bar. In the event handler i wrote the below code. This is selecting only last record. But i want to read all selected rows.

--- htm page

<chmlb:configTable id          = "Table"

reset       = "<%= controller->get_reset_flag( ) %>"

actions     = "<%= controller->gt_button %>"

navigationMode  = "BYPAGE"

table       = "//RESULT/Table"

visibleRowCount = "<%= lv_visiblerows %>"

usage       = "SEARCHRESULT"

downloadToExcel = "<%= lv_export %>"

selectedRowIndexTable = "<%= RESULT->SELECTION_TAB %>"

selectionMode     = "<%= RESULT->SELMODE_MULTI %>"

onRowSelection    = "SELECT"

showNoMatchText = "FALSE" />

method submit.

  data: lv_collection TYPE REF TO if_bol_bo_col,

      lv_property_access TYPE REF TO if_bol_bo_property_access.

     lv_collection ?= me->typed_context->result->collection_wrapper->get_marked( ).

     lv_property_access = lv_collection->get_first( ).

     WHILE lv_property_access IS not INITIAL.

         lv_property_access = lv_collection->get_next( ).

     endwhile.

endmethod.

Thanks

Tim

Former Member
0 Kudos

Hi Tim,

In your Code Get marked Method will have only last selected row.  In your row selection method you have to loop & move all selected row entity to the get_marked method. Otherwise in your row selection event method do the below logic.

  lr_coco ?= me->comp_controller.

CHECK lr_col IS BOUND.

while

     lr_col->add( lr_next ).

     lr_coco->typed_context->selecteditems->set_collection( collection = lr_col ).

endwhile.


Then "collection"  attribute will hold all the selected entity then you can use it in submit event method.

Thank you,

Chandrasekar Balan

former_member183993
Participant
0 Kudos

hi Cha,

Was there anything else you had to do to enable multiselect?  I am in component BP_CONT_SEARCH in the result view, can see the option to multiselect however the rows are not being marked/selected.

Any ideas on this?

thx

Chris

Answers (0)