Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

multiple selection of rows in alv output list

Former Member
0 Kudos

experts,

using 'REUSE_ALV_GRID_DISPLAY'

the following is the sample code ,without using ctrl or shift key i am unable to select multiple rows .

any resolvable answers.

REPORT zpushbutton1.

type-pools : slis.

*structure declarations

types : begin of ty_mara,

matnr type matnr,

ernam type ernam,

mbrsh type mbrsh,

CHKBOX TYPE CHAR1,

end oF ty_mara.

types : begin of ty_marc,

matnr type matnr,

werks type werks_d,

pstat type pstat_d,

end of ty_marc.

*internal table declarations

DATA : gi_mara TYPE STANDARD TABLE OF TY_MARA INITIAL SIZE 0.

data : gi_fieldcat type slis_t_fieldcat_alv.

*workarea declarations

DATA : gs_mara TYPE TY_MARA,

gs_fieldcat type slis_fieldcat_alv.

SELECT matnr

ernam

mbrsh

FROM mara

INTO TABLE gi_mara

UP TO 10 ROWS.

perform build_fieldcat using :

'1' 'CHKBOX' 'GI_MARA' 'SELECT' 'X' ,

'2' 'MATNR' 'GI_MARA' 'MATEIRALNO' ' ',

'3' 'ERNAM' 'GI_MARA' 'PERSON CREAT' ' ',

'4' 'MBRSH' 'GI_MARA' 'INDUSTRY' ' '.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = SY-REPID

IT_FIELDCAT = GI_FIELDCAT

TABLES

t_outtab = GI_MARA

.

&----


*& Form BUILD_FIELDCAT

-


form BUILD_FIELDCAT using

PCOL TYPE CHAR2

PFLDNAME TYPE CHAR10

PTABNAME TYPE CHAR10

PSELTEXT TYPE CHAR15

PINPUT TYPE CHAR1.

GS_FIELDCAT-COL_POS = PCOL.

GS_FIELDCAT-FIELDNAME = PFLDNAME.

GS_FIELDCAT-TABNAME = PTABNAME.

GS_FIELDCAT-SELTEXT_M = PSELTEXT.

GS_FIELDCAT-EDIT = PINPUT.

APPEND GS_FIELDCAT TO GI_FIELDCAT.

CLEAR GS_FIELDCAT.

endform. " BUILD_FIELDCAT

thanks and regards

5 REPLIES 5

Former Member
0 Kudos

hi

u can use the

fieldcatalog to have an check box as one coloum in ur display and from ther u can select multple rows

like this

i_fcat-fieldname = 'CHECK'.

i_fcat-tabname = 'I_INV_DISPLAY'.

i_fcat-scrtext_s = 'CB'.

i_fcat-checkbox = 'X'.

i_fcat-edit = 'X'.

i_fcat-outputlen = 1.

i_fcat-fix_column = c_true_x.

APPEND i_fcat.

CLEAR i_fcat.

Cheers

Snehi

Edited by: snehi chouhan on Jul 15, 2008 1:17 PM

Former Member
0 Kudos

Have a look at the online help for this function module. It looks like you need to set up your output table - gi_mara - with an additional field at the start (probably type char1). You then need to create a variable of type LIS_LAYOUT_ALV to pass to the IS_LAYOUT parameter of the FM. You then set IS_LAYOUT-BOX_FIELDNAME equal to the name of the new field in gi_mara.

This should provide a check box at the start of each row that allows you to select multiple rows.

Never had to do this myself as I tend to use the cl_gui_alv_grid class. CXheck out the help and try it out.

Andy

Former Member
0 Kudos

experts,

can we set cursor properties during the output display

ex : i have used function module reuse_alv_grid_display to display a list of records with passing parameter

is_layout-box_fieldname and is_layout-box_tabname to list the first column as pushbutton.

when i select a row ,gets selected now when i move the

cursor (mouse) to the other row and select the row, the row previously selected will be deselected.

solution to the above problem is to hold the ctrl or shift key for

multiple selections.

is there any other alternative procedure so that without holding

ctrl or shift key multiple rows get selected.

thks and rgrds

Former Member
0 Kudos

only a part answered

0 Kudos

I've seen the functionality you talk of (eg FM 'FIELD_CHOICE' uses grids that allow you to select lines one at a time without deselecting previous rows) but I don't think the 'REUSE_ALV_GRID_DISPLAY' will do it. I certainly can't see any settings that allow this and have played around with it for a bit.

Why do you need it to behave like this?