1 "首先要在ALV显示的内表中添加下面字段
2 cellcolor type lvc_t_scol
3
4 "layout要把这个字段加上
5 gs_layout-ctab_fname = 'CELLCOLOR'.
6
7 DATA:gt_cellcolor TYPE lvc_t_scol, "单元格颜色表
8 gs_cellcolor TYPE lvc_s_scol.
9
10 LOOP AT gt_data ASSIGNING FIELD-SYMBOL(<fs_data>).
11
12 "这里可以添加IF条件设置颜色
13 "IF
14 gs_cellcolor-fname = 'ZSJJS1'."要修改颜色的字段名
15 gs_cellcolor-color-col = 6.
16 gs_cellcolor-color-int = 1.
17 gs_cellcolor-color-inv = 0.
18 APPEND gs_cellcolor TO <fs_data>-cellcolor.
19 "ENDIF
20
21 ENDLOOP .