Ótimo para ressaltar dados importantes.
---Exemplo---
REPORT ZSAPeiros.
TYPES:
BEGIN OF ty_saida,
campo1(4) TYPE c,
campo2(6) TYPE p DECIMALS 3,
color(4) TYPE c,
END OF ty_saida.
TYPE-POOLS:
slis.
DATA:
gt_saida TYPE TABLE OF ty_saida,
wa_saida TYPE ty_saida,
gt_fieldcat TYPE TABLE OF slis_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_layout TYPE slis_layout_alv.
* Seleção dos dados
PERFORM frm_select_data.
* Monta estrutura do relatório
PERFORM frm_alv_fieldcat.
* Define detalhes no layout do relatório
PERFORM frm_alv_layout.
* Exibe o relatório
PERFORM frm_alv_show.
*---------------------------------------------------------------------*
* Seleção dos dados
*---------------------------------------------------------------------*
FORM frm_select_data.
wa_saida-campo1 = '1'.
wa_saida-campo2 = '8'.
APPEND wa_saida TO gt_saida.
wa_saida-campo1 = '2'.
wa_saida-campo2 = '-73'.
APPEND wa_saida TO gt_saida.
wa_saida-campo1 = '3'.
wa_saida-campo2 = '20'.
APPEND wa_saida TO gt_saida.
wa_saida-campo1 = '4'.
wa_saida-campo2 = '50'.
APPEND wa_saida TO gt_saida.
wa_saida-campo1 = '5'.
wa_saida-campo2 = '-55'.
APPEND wa_saida TO gt_saida.
wa_saida-campo1 = '6'.
wa_saida-campo2 = '90'.
APPEND wa_saida TO gt_saida.
wa_saida-campo1 = '7'.
wa_saida-campo2 = '100'.
APPEND wa_saida TO gt_saida.
* Atualiza cores das linhas
LOOP AT gt_saida INTO wa_saida.
IF wa_saida-campo2 < 0.
wa_saida-color = 'C610'. "Vermelho
ELSEIF wa_saida-campo2 > 0 AND wa_saida-campo2 < 50.
wa_saida-color = 'C310'. "Amarelo
ELSEIF wa_saida-campo2 >= 50.
wa_saida-color = 'C510'. "Azul
ENDIF.
MODIFY gt_saida FROM wa_saida INDEX sy-tabix.
ENDLOOP.
ENDFORM. "frm_select_data
*---------------------------------------------------------------------*
* Monta estrutura do relatório
*---------------------------------------------------------------------*
FORM frm_alv_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'CAMPO1'.
wa_fieldcat-seltext_m = 'Campo 1'.
wa_fieldcat-tabname = 'GT_SAIDA'.
APPEND wa_fieldcat TO gt_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'CAMPO2'.
wa_fieldcat-seltext_m = 'Campo 2'.
wa_fieldcat-tabname = 'GT_SAIDA'.
APPEND wa_fieldcat TO gt_fieldcat.
ENDFORM. "frm_alv_fieldcat
*---------------------------------------------------------------------*
* Define detalhes no layout do relatório
*---------------------------------------------------------------------*
FORM frm_alv_layout.
wa_layout-expand_all = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-zebra = 'X'.
wa_layout-info_fieldname = 'COLOR'.
ENDFORM. "frm_alv_layout
*---------------------------------------------------------------------*
* Exibe o relatório
*---------------------------------------------------------------------*
FORM frm_alv_show.
DATA:
lv_repid TYPE sy-repid.
lv_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = lv_repid
is_layout = wa_layout
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = gt_saida
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. "frm_alv_show