FORMAT

Short Reference

Syntax

FORMAT [COLOR       {{{color [ON]}|OFF}|{= col}}]
       [INTENSIFIED [{ON|OFF}|{= flag}]]
       [INVERSE     [{ON|OFF}|{= flag}]]
       [HOTSPOT     [{ON|OFF}|{= flag}]]
       [INPUT       [{ON|OFF}|{= flag}]]
       [FRAMES      [{ON|OFF}|{= flag}]]
       [RESET].

Extras:

1. ... COLOR {{{color [ON]}|OFF}|{= col}}

2. ... INTENSIFIED [{ON|OFF}|{= flag}]

3. ... INVERSE [{ON|OFF}|{= flag}]

4. ... HOTSPOT [{ON|OFF}|{= flag}]

5. ... INPUT [{ON|OFF}|{= flag}]

6. ... FRAMES [{ON|OFF}|{= flag}]

7. ... RESET

Effect

The settings defined with FORMAT apply from the current position of the list cursor for all of the following output statements (WRITE and with ULINE)restrictions) until they are redefined by a new FORMATstatement. Within a line, the areas between the individual outputs and between the start of the line and the first output are formatted. Blank lines created with SKIP are not formatted, however.

The individual additons change the corresponding setting only and leave the others unchanged, with the exception of the RESET addition, which can change all settings.

At the start of the program, the standard settings for the settings that can be defined with FORMAT. These are set automatically for each reporting and list event (with the exception of the attribute set by FRAMES). A table of the standard settings is located in the description of the RESET addition.

For each individual WRITE output, the settings can be overridden by the use of the same additions in the WRITE additions. The settings that are defined with FORMAT or the standard settings then apply again.

Below is a description of the individual additions:

Addition 1

... COLOR {{{color [ON]}|OFF}|{= col}}

Effect

This addition sets the color of the output. If the attribute INVERSE is set to OFF (default setting), this sets the background color of the output. If the attribute INVERSE is set to ON, this sets the foreground color of the output.

You can specify the color either statically using color , or dynamically using col. For color, use the syntax directly from the following table. You do not need to specify ON. For col, a data object of type i is expected, which containsone of the values from the following table. If col contains a different value, this is handled like the value 0.

Syntax of color value in col color
{ COL_BACKGROUND } 0 GUI-specific
{ 1 | COL_HEADING } 1 Gray-blue
{ 2 | COL_NORMAL } 2 Light gray
{ 3 | COL_TOTAL } 3 Yellow
{ 4 | COL_KEY } 4 Blue-green
{ 5 | COL_POSITIVE } 5 Green
{ 6 | COL_NEGATIVE } 6 Red
{ 7 | COL_GROUP } 7 Violet

The OFF has the same effect as COL_BACKGROUND or the value 0 in col and is the default setting. In this setting, the color of the background corresponds to a line of the background color of the GUI window.

The COLOR addition does not affect lines that are made of line elements, or on windows that are ready for input.

Addition 2

... INTENSIFIED [{ON|OFF}|{= flag}]

Effect

This addition determines the intensity of the background color. For flag, a data object of type i is expected. If ON is specified or if the content of flag is not equal to 0, an intensive background color is used (default setting). If OFF is specified or if the content of flag is equal to 0, a weak background color is used. An exception to this is the COL_BACKGROUND background color, with which INTENSIFIED OFF influences the foreground color. If neither ON, OFF nor flag are specified after INTENSIFIED, then the ON addition takes effect.

At the same time if the INPUT ON attribute is set, the INTENSIFIED OFF addition changes the foreground color of fields that are ready for input. If the INVERSE ON setting is made at the same time, the INTENSIFIED OFF setting has no effect (with the exception of COL_BACKGROUND).

Addition 3

... INVERSE [{ON|OFF}|{= flag}]

Effect

This addition determines whether the COLOR addition sets the background or the foreground color. For flag, a data object of type i is expected. If ON is specified or the content of flag is not equal to 0, then the foreground that is, the output, is displayed in the selected color. An exception to this is the COL_BACKGROUND color, with which the foreground is displayed in white. If OFF is specified or if the content of flag is equal to 0, the background is displayed in the selected color (default setting). If ON, OFF nor flag are specified after INVERSE then the ON addition takes effect.

At the same time if attribute INPUT ON is set, the addition INVERSE ON changes the background and foreground color of fields that are ready for input.

Example

Demonstration of different combinations of additions COLOR, INTENSIFIED and INVERSE. The program SHOWCOLO provides a similar result.

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.
ENDDO.

Addition 4

... HOTSPOT [{ON|OFF}|{= flag}]

Effect

This addition influences the display of the mouse pointer and the function of the mouse in the list displayed on the screen. For flag, a data object of type i is expected. If ON is specified or if the content of flag is not equal to 0, then when the mouse pointer is positioned on the list area that is formatted correspondingly, it changes its appearance to a hand, and a single click has the same effect as a double-click, that is, selection of function key F2. If OFF is specified or if the content of flag is equal to 0, the function of the mouse does not change (default setting). If neither ON, OFF nor flag is specified after HOTSPOT, then the ON addition takes effect.

If the attribute INPUT ON is set, the HOTSPOT ON addition has no effect on line elements.

Example

Demonstration of a hotspot. Clicking once on the output creates a details list.

START-OF-SELECTION.
  FORMAT HOTSPOT.
  WRITE 'Click me!' COLOR 5.
  FORMAT HOTSPOT OFF.

AT LINE-SELECTION.
  WRITE 'Yeah!' COLOR 3.

Addition 5

... INPUT [{ON|OFF}|{= flag}]

Effect

This addition makes list areas ready for input. For flag, a data object of type i is expected. If ON is specified or the content of flag is not equal to 0, the relevant list area is displayed with a different foreground and background color than the rest of the list, and the user can overwrite the output. The screen cursor is positioned in the first field that is ready for input. If OFFis specified or the content of flag is equal to 0, the output is not made ready for input (default setting). If neither ON, OFF nor flag is specified after INPUT, the ON addition takes effect.

Within an area that is ready for input, icons are displayed empty and symbols are displayed as characters according to the codepage. Line elements are not made ready for input. The "-" und "|" characters in a list area that is ready for input are not converted into line elements, however, and are displayed ready for input. the latter applies particularly to the ULINE statement.

The width of the list area that is ready for input is defined by the output length. If in Unicode systems the display of contents from the list buffer in a list area that is ready for input results in truncation, the indicator is placed outside the area. The number of characters that can be entered is limited by the output length. The content cannot be moved. In ar. In Unicode systems, the number of characters that can be entered depends on the space that the individual characters require.

The entries made by the user are saved in the list buffer and can be evaluated during a list event. If characters were truncated in the list, then they will also be lost in the list buffer.

Note

If a list line contains an inout field with blank characters exclusively, it is not displayed if the SET BLANK LINES ON statement was not executed beforehand.

Example

Output of a ready for input field and evaluation of the AT-LINE-SELECTION result. The evaluation is done only if the user clicks on the hotspot below the line that is ready for input.

DATA: input_field TYPE c LENGTH 100,
      line_num TYPE i.

START-OF-SELECTION.
  WRITE 'Input text:'.
  SET BLANK LINES ON.
  FORMAT INPUT.
  WRITE / input_field.
  FORMAT INPUT OFF.
  WRITE / '>>> OK <<<' COLOR 5 HOTSPOT.

AT LINE-SELECTION.
  IF sy-lisel = '>>> OK <<<'.
    line_num = sy-lilli - 1.
    READ LINE line_num FIELD VALUE input_field.
    WRITE:   'The input was:',
           /  input_field.
  ENDIF.

Addition 6

... FRAMES [{ON|OFF}|{= flag}]

Effect

This addition determines whether the "-" and "|" characters are converted into line elements. For flag, a data object of type i is expected. If ON is specified or if the content of flag is not equal to 0, the conversion is made in the relevant list area (default setting). If OFF is specified or if the content of flag is not equal to 0, the conversion does not take place. If neither ON, OFF nor flag are specified after FRAMES, the ON addition takes effect.

In the FRAMES ON setting, the following points apply:

In the FRAMES OFF setting, the "-" and "|" are not converted into line elements. You can explicitly output line elements using the AS LINE addition.

Note

The FRAMES OFF addition is suitable for preventing unwanted results in print lists. This applies particularly to lists that are intended for archiving.

Example

Output of a frame with an without connecting the characters "-" and "|".

FORMAT FRAMES ON.
PERFORM frame.
FORMAT FRAMES OFF.
PERFORM frame.

FORM frame.
  SKIP.
  WRITE: / '----',
         / '|  |',
         / '----'.
ENDFORM.

Addition 7

... RESET

Effect

This addition sets all formatting settings for which the corresponding addition is not specified in the same FORMAT statement to the state OFF, apart from the setting of the FRAMES addition, which is set to ON. For settings whose addition is also specified, the RESET addition has no effect,

The following table shows the effect of RESET compared with the default setting, the setting at the program start and the setting that is made for reporting and list events.

State State after RESET State after program start State after reporting or list event
COLOR OFF OFF OFF
INTENSIFIED OFF ON ON
INVERSE OFF OFF OFF
HOTSPOT OFF OFF OFF
INPUT OFF OFF OFF
FRAMES ON ON No change

Example

This FORMAT statement creates the default setting after the program starts.

FORMAT RESET
       INTENSIFIED ON.