ALV color is dividedRow color,Column colorAndCell color.
The task requires that tabellenfeld be filled in yellow, that is
Cell color
Data:
Ls_cellcolortypelvc_s_scol,
Coltabtypelvc_t_scol,
Colortypelvc_s_colo.
Data: Begin offield_struc, "define the color in the Table Structure
....
Cellcolortypelvc_t_scol,
End offield_struc.
View_tab ist eine structur von field_struc.
* Farbe einsetzen
Color-Col = '3 '.
Color-Int = '1 '.
Color-inv = '0 '.
Loop atxxx into view_tab.
If two tables have different data values.
Ls_cellcolor-fname = 'wears '. "specifies the column name
Ls_cellcolor-color = color.
Appendls_cellcolor to coltab.
Clearls_cellcolor.
Endif.
View_tab-cellcolor = coltab.
Appendview_tabtoit_view.
Endloop.
Row color[Quelle: http://blog.csdn.net/zltpc007/archive/2008/10/18/3095850.aspx]
You need to add a field in the table to display color information, such as color (4) type C.
ITAB-COLOR = 'c700 '.
In addition, you must set the display color based on the FM or class method.
- FM: LS_LAYOUT-INFO_FIELDNAME = 'color '.
Call function 'reuse _ alv_grid_display'
Exporting
Is_layout = ls_layout
It_fieldcat = lt_fieldcat
Tables
T_outtab = itab.
· Class method:SLA-Info_fname = 'color '.
Call method go_grid-> set_table_for_first_display
Exporting
Is_variant = gs_variant
I _save = 'A'
Is_layout =SLA
Changing
It_outtab = itab []
It_fieldcatalog = gt_fieldcat []
Exceptions
Invalid_parameter_combination = 1
Program_error = 2
Too_many_lines = 3
Others = 4.
Column color
Set fieldcat, for example, the color of the TMP_FIELDCAT-EMPHASIZE = 'c500 '. "column