07-04-2007 9:55 AM
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
07-04-2007 10:04 AM
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'.
07-04-2007 10:06 AM
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.
07-04-2007 10:07 AM
*--- 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.