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: 

ALV GRID, CHANGE ROW COLOR AFTER FIRST DISPLAY

Former Member
0 Kudos

HI FRIENDS,

I wants to change row color of an alv grid after it's first display.

for that i am using SET_TABLE_FOR_FIRST_DISPLAY method.

but now i want to change color of row within PAI event.

Can any one gives me code for that.

Thank you.

Regards,

Virat

3 REPLIES 3

Former Member
0 Kudos

hi,

add one more column in ur internal table(which u r passing to that alv method) as zcolor with type CHAR OF LENGTH 4.

AND PASS 'C211' value to that field. so that u can get color in ur alv grid.

where c211 in which 2 is for color u can change this value for ur preference color.

and pass this field zcolor to this field as gs_layout-info_fieldname

gs_layout-info_fieldname = 'ZCOLOR'.

Former Member
0 Kudos

1 . add one more field to ur final internal table say COLOR(4).

2. in layout

wa_layout-info_fname = 'COLOR'.

3. in PAI

loop at itab.

if sy-tabix LE 5.

itab-COLOR = 'C410'.

modify itab index sy-tabix.

endif.

endloop.

Former Member
0 Kudos

*--- 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 .

then,

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' .

APPEND ls_cellcolor TO gt_list-cellcolors .

MODIFY gt_list INDEX 5 .

Hope this helps you,

Regards,

Pavan P.