1 1 1 1 1 Rating 0% (0 Votes)
Tags: FALV
The latest version of each part of FALV can be found on github repository https://github.com/fidley/falv which you can use in abapGit for easier up to date handling. 
 
This example shows how to set colors for cells, rows and columns using FALV

"! This is demo for FALV full screen with color settings
"! done by Lukasz Pegiel for http://abapblog.com

report zdemo_falv10.

typesbegin of t_sflight.
        include type sflight.
types:  cell_color type lvc_t_scol,
        row_color  type char4,
        end of t_sflight.

datasflight type standard table of t_sflight.

start-of-selection.


  select up to 100 rows
  into corresponding fields of table @sflight
  from sflight.

  "FALV creation with only table passed
  data(falvzcl_falv=>createchanging ct_table sflight ).

  "Add title variable
  falv->title_v1 'ZDEMO_FALV10'.


  "Changing some of field catalog settings for column colors
  falv->column'SEATSMAX' )->set_color'C700' ).

  "setting of color fields -> this must be done before calling
  "set_row_colors or set_cell_color
  falv->layout->set_ctab_fname'CELL_COLOR' ).
  falv->layout->set_info_fname'ROW_COLOR'  ).

  "change some row colors
  do 10 times.
    falv->set_row_color(
      exporting
        iv_color 'C300'
        iv_row   * sy-index
    ).
  enddo.

  "change some cell colors.
  do 10 times.
    falv->set_cell_color(
      exporting
        iv_fieldname 'PLANETYPE'
        iv_color     value #col int inv 0  )
        iv_row       * sy-index
    ).

  enddo.



  "Display full screen grid
  falv->display).

 
Result of the program