Select language:
Entering content frameColors in Lists 

The options COLOR, INTENSIFIED, and INVERSE of the FORMAT statement influence the colors of the output list.

To set colors in the program, use:

Syntax

FORMAT COLOR <n> [ON] INTENSIFIED [ON|OFF] INVERSE [ON|OFF].

To set colors at runtime, use:

Syntax

FORMAT COLOR = <c> INTENSIFIED = <int> INVERSE = <inv>.

These formatting options do not apply to horizontal lines created by ULINE. They have the following functions:

  • COLOR sets the color of the line background. If, in addition, INVERSE ON is set, the system changes the foreground color instead of the background color.

For <n> you can set either a color number or a color specification. Instead of color number 0, however, you must use OFF. If you set the color numbers at runtime, all values of <c> that are less than zero or greater than seven, lead to undefined results. The following table summarizes the different possibilities:

 

<n>

<c>

Color

Intended for

OFF

or COL_BACKGROUND

0

depends on GUI

background

1

or COL_HEADING

1

gray-blue

headers

2

or COL_NORMAL

2

light gray

list bodies

3

or COL_TOTAL

3

yellow

totals

4

or COL_KEY

4

blue-green

key columns

5

or COL_POSITIVE

5

green

positive threshold value

6

or COL_NEGATIVE

6

red

negative threshold value

7

or COL_GROUP

7

violet

Control levels

The default setting is COLOR OFF.

  • INTENSIFIED determines the color palette for the line background.

With one exception (COLOR OFF), the color palette for the line background specified above can be intensified or normal. The default setting is INTENSIFIED ON. For COLOR OFF, the system changes the foreground color instead of the background color. If, in addition, INVERSE ON is set, then INTENSIFIED OFF has no effect (again with the exception of COLOR OFF).

  • INVERSE affects the foreground color.

With one exception (COLOF OFF), the system takes the COLOR specified from an inverse color palette and uses it as foreground color. The background color remains unchanged. For COLOR OFF, INVERSE has no effect, since this would set the foreground and the background to the same color.

Note

The following statements have the same effect:

FORMAT INTENSIFIED ON.

and SUMMARY.

FORMAT INTENSIFIED OFF and

DETAIL.

However, SAP recommends that you always use the FORMAT statement, since it makes programs easier to read.

The following examples show the colors possible in lists and how to use them.

For another demonstration of colors in lists, call the executable program SHOWCOLO in any system.

Demonstrating the Colors Available in Lists

The following example shows the different combinations of the color formatting options:

Example

REPORT demo_list_format_color_1.

DATA i TYPE i VALUE 0.
DATA col(15) TYPE c.

WHILE i < 8.

 CASE i.
 WHEN 0. col = 'COL_BACKGROUND '.
 WHEN 1. col = 'COL_HEADING '.
 WHEN 2. col = 'COL_NORMAL  '.
 WHEN 3. col = 'COL_TOTAL '.
 WHEN 4. col = 'COL_KEY '.
 WHEN 5. col = 'COL_POSITIVE  '.
 WHEN 6. col = 'COL_NEGATIVE  '.
 WHEN 7. col = 'COL_GROUP '.
ENDCASE.

 FORMAT INTENSIFIED COLOR = i.
 WRITE: /(4) i, AT 7 sy-vline,
 col,  sy-vline,
 col INTENSIFIED OFF, sy-vline,
 col INVERSE.

 i = i + 1.

ENDWHILE.

In the FORMAT statement, the COLOR option for the subsequent WRITE statements is set at runtime. The other options are set individually for each WRITE statement in the program.

The output appears as shown in the following table:

This graphic is explained in the accompanying text

The standard page header was created as a text element. In the online help, due to technical reasons, the colors of this list differ slightly from the colors of the R/3 system.

Example of Using Colors in Lists

This example shows how to use colors in lists to highlight output.

Example

The following executable program (report) is connected to the logical database F1S.

REPORT demo_list_format_color_2 NO STANDARD PAGE HEADING LINE-SIZE 70.

TABLES: spfli, sflight.
DATA sum TYPE i.

TOP-OF-PAGE.

WRITE 'List of Flights' COLOR COL_HEADING.
ULINE.

GET spfli.

FORMAT COLOR COL_HEADING.
 WRITE: 'CARRID', 10 'CONNID', 20 'FROM', 40 'TO'.

FORMAT COLOR COL_KEY.
 WRITE: / spfli-carrid  UNDER 'CARRID',
  spfli-connid  UNDER 'CONNID',
  spfli-cityfrom UNDER 'FROM',
  spfli-cityto  UNDER 'TO'.
ULINE.

FORMAT COLOR COL_HEADING.
 WRITE: 'Date', 20 'Seats Occupied', 50 'Seats Available'.
ULINE.

 sum = 0.

GET sflight.

 IF sflight-seatsocc LE 10.
 FORMAT COLOR COL_NEGATIVE.
ELSE.
FORMAT COLOR COL_NORMAL.
ENDIF.

 WRITE: sflight-fldate  UNDER 'Date',
  sflight-seatsocc UNDER 'Seats Occupied',
  sflight-seatsmax UNDER 'Seats Available'.

 sum = sum + sflight-seatsocc.

GET spfli LATE.

ULINE.
 WRITE: 'Total Bookings: ' INTENSIFIED OFF,
  sum COLOR COL_TOTAL.
ULINE.
SKIP.

The report creates the following output list:

This graphic is explained in the accompanying text

All headers appear using the background color COL_HEADING. The key fields from table SPFLI use COL_KEY as background color. The list body at the event GET SFLIGHT has a different line background color (COL_NORMAL) than the list background (COL_BACKGROUND). In addition, flights where the number of bookings falls below a certain minimum number, have a red background. The total number of bookings for each flight has a yellow background.

Note that the system resets the formatting options for each new event to the default settings (COLOR OFF, INTENSIFIED ON). For this reason, in the above program the line background of the output 'Total Bookings:' is COL_BACKGROUND again in the GET LATE event. INTENSIFIED is set to OFF to get the same foreground color as for the other output.

In the online help, the colors of this list differ slightly from the colors of the R/3 system (for technical reasons).

 

 

 

 

Leaving content frame