1, format
FORMAT may be used to adjust the output of the color, format syntax is as follows:
1
|
FORMAT <option1> [ON|OFF] <option2> [ON|OFF]........
|
Once set ON by setting the format FORMAT statement statement will apply to all subsequent output OFF option is closed again until use, which specific list of options:
COLOR n [ON | OFF]: set the background color of the list row.
INTENSIFIED [ON | OFF]: Set whether to strengthen the field output.
INVERSE [ON | OFF]: set whether the background color of the text inverted output.
HOTSPOT [ON | OFF]: Move the cursor to a hand display type, click to select the event trigger line (hot spots).
INPUT [ON | OFF]: setting input fields that allow a user input.
RESET: to restore all default values set above.
WRITE colors can come out in fact very small, probably only eight species, as follows:
COLOR type and description | ||
No | COLOR | DESC |
0 | COL_BACKGROUND | Background(GUI-specific) |
1 | COL_HEADING | Headers(grayish blue) |
2 | COL_NORMAL | List body(bright gray) |
3 | COL_TOTAL | Totals(yellow) |
4 | COL_KEY | Key columns(bluish green) |
5 | COL_POSITIVE | Positive threshold value(green) |
6 | COL_NEGATIVE | Negative threshold value(red) |
7 | COL_GROUP | Control levels(violet) |
Example code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
REPORT ztest_list_color.
DATA col TYPE i VALUE 0.
DO 8 TIMES.
col = sy-index - 1.
FORMAT COLOR = col.
WRITE :/ col COLOR OFF,
'INTENSIFIED ON' INTENSIFIED ON,
'INTENSIFIED OFF' INTENSIFIED OFF,
'INVERSE ON' INVERSE ON,
'INVERSE OFF' INVERSE OFF,
'HOTSPOT ON' HOTSPOT ON,
'HOTSPOT OFF' HOTSPOT OFF,
'INPUT ON' INPUT ON,
'INPUT OFF' INPUT OFF,
'FRAMES ON' FRAMES ON,
'FRAMES OFF' FRAMES OFF,
'RESET' RESET.
ENDDO.
|
Run as follows:
2, color
The second method is the use of color keyword write the statement, the syntax is as follows:
1
|
... [COLOR {[=]{color [ON]}|OFF}|{= col}]
|
8 colors can be output, as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
REPORT ztest_list_color2.
DATA sum TYPE i.
WRITE: 'COL_BACKGROUND', sum COLOR COL_BACKGROUND.
ULINE.
WRITE: 'COL_HEADING ', sum COLOR COL_HEADING.
ULINE.
WRITE: 'COL_NORMAL ', sum COLOR COL_NORMAL.
ULINE.
WRITE: 'COL_TOTAL ', sum COLOR COL_TOTAL.
ULINE.
WRITE: 'COL_KEY ', sum COLOR COL_KEY.
ULINE.
WRITE: 'COL_POSITIVE ', sum COLOR COL_POSITIVE.
ULINE.
WRITE: 'COL_NEGATIVE ', sum COLOR COL_NEGATIVE.
ULINE.
WRITE: 'COL_GROUP ', sum COLOR COL_GROUP .
|
operation result:
the above.