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 color codes

Former Member
0 Kudos

Hi all,

I understand that the ALV grid color codes consists of the following format:

CXYZ

X = 0 - 7

Y,Z = 0 - 1

Is there any way to display color other than the above? I need a dark grey color (the color when the grid is set to not editable). Is there anywhere to do that? The intensity option is not helping much.

Thanks in advance.

7 REPLIES 7

Former Member

Former Member

1 gray-blue headers

2 light gray list bodies

3 yellow totals

4 blue-green key columns

5 green positive threshold value

6 red negative threshold value

7 orange Control levels

http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm

Former Member
0 Kudos

Hi, I understand I could get those standard colors by assigning from 0-7. My actual question is whether it is possible to get more colors other than those. Thanks in advance.

0 Kudos

Using that combination only you can get it.

Rearrange the numbers and try to get a color u like.

p291102
Active Contributor
0 Kudos

Hi,

Herewith i am sending for the sample code with alv grid report.

REPORT YMS_COLOURALV NO STANDARD PAGE HEADING.

TYPE-POOLS: SLIS, ICON.

DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

DATA: BEGIN OF IMARA OCCURS 0,

LIGHT(4) TYPE C,

MATNR TYPE MARA-MATNR,

MTART TYPE MARA-MTART,

MAKTX TYPE MAKT-MAKTX,

COLOR_LINE(4) TYPE C,

TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell

END OF IMARA.

DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.

START-OF-SELECTION.

PERFORM GET_DATA.

PERFORM WRITE_REPORT.

************************************************************************

  • Get_Data

************************************************************************

FORM GET_DATA.

WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.

IMARA-MATNR = 'ABC'.

IMARA-MTART = 'ZCFG'.

IMARA-MAKTX = 'This is description for ABC'.

APPEND IMARA.

WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.

IMARA-MATNR = 'DEF'.

IMARA-MTART = 'ZCFG'.

IMARA-MAKTX = 'This is description for DEF'.

APPEND IMARA.

WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.

IMARA-MATNR = 'GHI'.

IMARA-MTART = 'ZCFG'.

IMARA-MAKTX = 'This is description for GHI'.

APPEND IMARA.

LOOP AT IMARA.

IF SY-TABIX = 1.

IMARA-COLOR_LINE = 'C410'. " color line

ENDIF.

IF SY-TABIX = 2. " color CELL

CLEAR XCOLOR.

XCOLOR-FIELDNAME = 'MTART'.

XCOLOR-COLOR-COL = '3'.

XCOLOR-COLOR-INT = '1'. " Intensified on/off

XCOLOR-COLOR-INV = '0'.

APPEND XCOLOR TO IMARA-TCOLOR.

ENDIF.

MODIFY IMARA.

ENDLOOP.

ENDFORM. "get_data

************************************************************************

  • WRITE_REPORT

************************************************************************

FORM WRITE_REPORT.

DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.

LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.

LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.

PERFORM BUILD_FIELD_CATALOG.

  • CALL ABAP LIST VIEWER (ALV)

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

IS_LAYOUT = LAYOUT

IT_FIELDCAT = FIELDCAT

TABLES

T_OUTTAB = IMARA.

ENDFORM. "write_report

************************************************************************

  • BUILD_FIELD_CATALOG

************************************************************************

FORM BUILD_FIELD_CATALOG.

DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.

CLEAR: FIELDCAT. REFRESH: FIELDCAT.

CLEAR: FC_TMP.

FC_TMP-REPTEXT_DDIC = 'Status'.

FC_TMP-FIELDNAME = 'LIGHT'.

FC_TMP-TABNAME = 'IMARA'.

FC_TMP-OUTPUTLEN = '4'.

FC_TMP-ICON = 'X'.

APPEND FC_TMP TO FIELDCAT.

CLEAR: FC_TMP.

FC_TMP-REPTEXT_DDIC = 'Material Number'.

FC_TMP-FIELDNAME = 'MATNR'.

FC_TMP-TABNAME = 'IMARA'.

FC_TMP-OUTPUTLEN = '18'.

APPEND FC_TMP TO FIELDCAT.

CLEAR: FC_TMP.

FC_TMP-REPTEXT_DDIC = 'Material Type'.

FC_TMP-FIELDNAME = 'MTART'.

FC_TMP-TABNAME = 'IMARA'.

FC_TMP-OUTPUTLEN = '10'.

APPEND FC_TMP TO FIELDCAT.

CLEAR: FC_TMP.

FC_TMP-REPTEXT_DDIC = 'Material'.

FC_TMP-FIELDNAME = 'MAKTX'.

FC_TMP-TABNAME = 'IMARA'.

FC_TMP-OUTPUTLEN = '40'.

FC_TMP-EMPHASIZE = 'C610'. " color column

APPEND FC_TMP TO FIELDCAT.

ENDFORM. "build_field_catalog

Thanks,

Shankar

Former Member
0 Kudos

The combination from the color codes was some what limited. I would like to display some of my row in white color. Can I get WHITE color from the color code combination? Any other way to get WHITE color to be display on the row? Thanks in advance.

Former Member

Hi alvin,

check out this program to get the possible color combinations

<b>SHOWCOLO</b>