Pages

Tuesday, May 4, 2010

ALV cell coloring

In this procedure, again we must tell the control the name of the inner table containing color data. The field “CTAB_FNAME” of the layout structure is used for this purpose.
Code Part 14 – Adding inner table that will contain cell color data
*--- 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 .
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 .
Code Part 15 – A sample code to make the cell at row 5 and column ‘SEATSOCC’ colored
A juicy-brained guy may ask what happens if all these three procedures applied for coloring at