Process documentationColoring Rows Locate this document in the navigation structure

 

You can color rows in the grid control different colors and in this way highlight data in the list.

Note Note

Columns can be colored using the field EMPHASIZE of the field catalog (see: Column Output Options).

End of the note.

Process

  1. Define the Layout Structure of type LVC_S_LAYO.

  2. Extend your output table by a four-digit character field as in the following example:

    Syntax Syntax

    1. DATA: BEGIN OF GT_OUTTAB OCCURS 0.
      	INCLUDE STRUCTURE <DDIC-Struktur>.
      DATA: linecolor(4) type c. "Color for corresponding line
      DATA: END OF GT_OUTTAB.
    End of the code.
  3. Select your data and copy it into the output table.

  4. Read one row of the output table at a time in a loop. To change the color of rows, assign the character field a four-digit color code.

    Note Note

    You can find more about color coding in the EMPHASIZE field of the field catalog (see Column Output Options).

    End of the note.
  5. Assign the name of the internal table to the field INFO_FNAME of the layout structure (which, in our case, is 'LINECOLOR', see step 2).

  6. Pass the layout structure and the output table with method set_table_for_first_display.

    Note Note

    If you do not want to color cells for the first display, execute step 4 later and refresh the output table with the method refresh_table_display.

    End of the note.
Accessible Color Display

To make colored identifiers of ALV elements accessible to visually-impaired users it is necessary to maintain a tool tip for the color.

For this you have to maintain some fields in the table it_except_qinfo for the interface CL_GUI_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY:

TYPE

Mandatory

4 (= Color)

FIELDNAME

optional

Only has to be completed if the meaning of the color in relation to the related values for VALUE and TEXT is only valid in a special column of the ALV.

VALUE

Mandatory

Color of elements.

TEXT

Mandatory

Tooltip text.

Note Note

Table it_except_qinfo is of type slist_t_qinfo_alv.

End of the note.