I need to enable multiple selection of rows in ALV grid (especially REUSE_ALV_GRID_DISPLAY
). Currently to select more than one row, I'm using Ctrl + select rows. Is there any other way we can use? I'm using ABAP on ECC.
Asked
Active
Viewed 6,138 times
0

Sandra Rossi
- 11,934
- 5
- 22
- 48

Akshay vijayan
- 11
- 1
- 4
-
2Which ALV technology do you use? – Sandra Rossi Jul 28 '22 at 17:05
-
1I'm using Reuse_Alv_grid_display Fm.I hope u meant that – Akshay vijayan Jul 30 '22 at 06:11
-
Thanks. It's exactly the information that was missing. Other ALV technologies are REUSE_ALV_LIST_DISPLAY, CL_GUI_ALV_GRID, CL_SALV_TABLE, ALV hierarchical-sequential list, ALV tree, ALV Block List, ALV IDA, ALV Web Dynpro, etc. – Sandra Rossi Jul 30 '22 at 14:54
2 Answers
1
You need to SEL_MODE parameter during ALV creation.
- A Multiple columns, multiple rows with selection buttons.
- B Simple selection, listbox, Single row/column
- C Multiple rows without buttons
- D Multiple rows with buttons and select all ICON
Source: https://keremkoseoglu.wordpress.com/2009/06/29/cl_gui_alv_grid-line-selection-modes-in-abap/

mkysoft
- 5,392
- 1
- 21
- 30
-
I'm using Reuse_alv_grid_display Fm ..There is also sel_mode parameter.. I tried that .But didn't worked – Akshay vijayan Jul 30 '22 at 06:09
-
If you want to use selection box, you need to add a field to your structure and setting this field name to box_fieldname param. – mkysoft Aug 04 '22 at 08:45
0
With REUSE_ALV_GRID_DISPLAY
, you need to have a dedicated field in the ALV table to contain whether the line is selected or not, and the framework will understand that the ALV must enable the feature "multiple row selection":
TYPES: BEGIN OF ty_alv_line,
selected TYPE abap_bool,
carrid TYPE scarr-carrid,
carrname TYPE scarr-carrname,
END OF ty_alv_line.
DATA(layout) = VALUE slis_layout_alv(
box_fieldname = 'SELECTED' ).
SELECT 'X' AS selected, carrid, carrname FROM scarr INTO TABLE @DATA(scarr_table).
DATA(field_catalog) = VALUE slis_t_fieldcat_alv(
( col_pos = 1 fieldname = 'SELECTED' tech = 'X' )
( col_pos = 2 fieldname = 'CARRID' ref_fieldname = 'CARRID' ref_tabname = 'SCARR' )
( col_pos = 3 fieldname = 'CARRNAME' ref_fieldname = 'CARRNAME' ref_tabname = 'SCARR' ) ).
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = layout
it_fieldcat = field_catalog
TABLES
t_outtab = scarr_table
EXCEPTIONS
OTHERS = 1.
NB: the example doesn't demonstrate the processing of selected lines (could be done by adding both a custom button and a subroutine to handle when it's pressed) ; the syntax above needs at least ABAP 7.40.

Sandra Rossi
- 11,934
- 5
- 22
- 48