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: 

gray a row in alv list

Former Member
0 Kudos

hi all,

in an alv list in which fields are made editable, i want make the entire row grayed out for particular condition. how can it be done. i know to gray individual fields, but i want to gray the entire row.

Thanks in advance.

Regards,

Radhika

5 REPLIES 5

Former Member
0 Kudos

Use style in this case.

use the style CL_GUI_ALV_GRID=>MC_STYLE_DISABLED to disable a particular row.

Cheers,

KD

0 Kudos

ya... but this has to be used for individual fields. i want to gray the entire row. isn't ther any other method??

0 Kudos

you need to do the same for all the cells.

LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.

"For other columns too then the row completely Disabled
....
....
....

INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                  HANDLE_STYLE .

0 Kudos

Hi,

This would help--

*--- Internal table holding list data

DATA BEGIN OF gt_list OCCURS 0 .

INCLUDE STRUCTURE SFLIGHT .

DATA rowcolor(4) TYPE c .

DATA cellcolors TYPE lvc_t_scol .

DATA END OF gt_list .

Code Part 14 u2013 Adding inner table that will contain cell color data

DATA ls_cellcolor TYPE lvc_s_scol .

...

READ TABLE gt_list INDEX 5 .

ls_cellcolor-fname = 'SEATSOCC' .

ls_cellcolor-color-col = '7' .

ls_cellcolor-color-int = '1' .

.....same for all the fields in the row

APPEND ls_cellcolor TO gt_list-cellcolors .

MODIFY gt_list INDEX 5 .

**Code Part 15 u2013 A sample code to make the cell at row 5 to a particular color

Cheers,

KD

ajay_sharma10
Participant
0 Kudos

This message was moderated.