Copyright 2024 - BV TallVision IT

Quick reference to the available colors in ALV, where the first number is INT (Intensified: 0 or 1), the second INV (Inverse 0 or 1) and the third number is COL (the color number, 0 to 7).

 ALV color scheme

So if you want to select a color and inform a developer to use it, you can say: the INT/INV/COL number for the color I want to use it 113 (which is very very similar to 103, but hej). Refer to this page to help him/her along. 

An example program with all key factors to setting colors in an ALV report:

types: begin of ty_content, 
         matnr type makt-matnr,
         maktx type makt-maktx,
         COLORS type lvc_t_scol,
       end of ty_content.
data: gt_data type table of ty_content,
      gw_data type ty_content,
      gw_color_field type lvc_s_scol,
      gw_color type lvc_s_colo,
      go_salv type ref to cl_salv_table,
      go_columns_table 
        type ref to cl_salv_columns_table.

  select matnr maktx from makt
    up to 20 rows into table gt_data
    where spras = 'EN'.

* Set the color of the material number to:
* INT=1, INV=0, COL=6, bright red
  loop at gt_data into gw_data.
    clear: gw_color_field, gw_color.
    gw_color_field-fname = 'MATNR'.
    gw_color-int = 1.
    gw_color-inv = 0.
    gw_color-col = 6.
    gw_color_field-color = gw_color.
    append gw_color_field to gw_data-colors.
    modify gt_data from gw_data.
  endloop.

  create object go_salv.                                     
  go_salv->set_alv_from_template( 
    changing content = gt_data ).
* A bit of logic to inform the SALV object 
* which column (COLORS) is 
* to be used for color settings:
  try.
    go_columns_table = go_salv->get_columns( ).
    go_columns_table->set_color_column( 
      value = 'COLORS' ).
    catch cx_salv_data_error.
* Field was not valid
  endtry.

  go_salv->display( ).