PRINT-CONTROL

Variants:

1. PRINT-CONTROL.

2. PRINT-CONTROL INDEX-LINE f.

Variant 1

PRINT-CONTROL.

Extras:

1. ... CPI cpi

2. ... LPI lpi

3. ... SIZE size

4. ... COLOR

... BLACK


... RED


... BLUE


... GREEN


... YELLOW


... PINK


5. ... LEFT MARGIN col

6. ... FONT font

7. ... FUNCTION f

8. ... LINE line

9. ... POSITION col

Effect

Determines the desired print format (see printing in ABAP) for the subsequent characters, starting from the current output position.

You define the output position either implicitly:

or explicitly:

With output to the screen or when printing screen output, the statement has no effect.

Furthermore, the PRINT-CONTROL statements must be repeated by the application program at the beginning of each new page to ensure that they are applied. This is because the list processor inserts COLxx print controls in the spool for the current format at the start of each page, and these can deactivate existing print control statements. The list processor does not store PRINT-CONTROL statements originating from the application program once it has placed them in the spool.

Addition 1

... CPI cpiLetters per inch

Addition 2

... LPI lpiLines per inch

Addition 3

... SIZE sizeScript size

Addition 4

... COLORColor ...
... BLACK black
... REDred
... BLUE blue
... GREENgreen
... YELLOWyellow
... PINKpink

Addition 5

... LEFT MARGIN colDistance from left edge

Addition 6

... FONT fontSet font

Addition 7

... FUNCTION fReference function directly as sub-
argument of Table T022D

Effect

Sets the specified print format for the subsequent characters, starting from the current output position.

Example

PRINT-CONTROL SIZE 2 COLOR BLACK FONT 5.

Addition 8

... LINE line

Effect

Explicitly sets the output line of the current page from which you want the PRINT-CONTROL options to take effect (from column 1).

Addition 9

... POSITION col

Effect

Explicitly sets the column of the line specified by the addition "LINE" from which you want the print options to take effect. If the addition "LINE" is missing, the current line is assumed.

Note

You must always use additions 8 and 9 in conjunction with one of the additions 1 to 7. They have no effect on the current line number (SY-LINNO) or column number ( SY-COLNO). You can thus also use the PRINT-CONTROL statements after all WRITE statements for the current page.

Example

WRITE: /.
PRINT-CONTROL FUNCTION 'PRCTL'.
WRITE : / 'Test print control'.
NEW-LINE.
WRITE: / 'Old print control still in effect'.

&ABAP_HINT'

The spool output in hexadecimal form:
#PRCTLTest print control
Old print control still in effect

Example

WRITE : /.
PRINT-CONTROL FUNCTION 'SBP01'.
WRITE : '123456789'.
PRINT-CONTROL FUNCTION 'SBS01'.

Note

The spool output in hexadecimal form:
#SBP01123456789 #SBS01
You can use this sequence of statements to print bar codes.

Note

Conversion to machine-specific control characters is performed via tables TSP03 and T022D:

+===================+==============================+
I Option            I Argument for table   I T022D I
+===================+======================+=======+
I CPI 'xxx'         I Printer name (TSP03) I CIxxx I
+-------------------+----------------------+-------+
I LPI 'xxx'         I Printer name (TSP03) I LIxxx I
+-------------------+----------------------+-------+
I SIZE 'xxx'        I Printer name (TSP03) I SIxxx I
+-------------------+----------------------+-------+
I FONT 'xxx'        I Printer name (TSP03) I FOxxx I
+-------------------+----------------------+-------+
I COLOR BLACK       I Printer name (TSP03) I CO001 I
+-------------------+----------------------+-------+
I COLOR RED         I Printer name (TSP03) I CO002 I
+-------------------+----------------------+-------+
I COLOR BLUE        I Printer name (TSP03) I CO003 I
+-------------------+----------------------+-------+
I COLOR GREEN       I Printer name (TSP03) I CO004 I
+-------------------+----------------------+-------+
I COLOR YELLOW      I Printer name (TSP03) I CO005 I
+-------------------+----------------------+-------+
I COLOR PINK        I Printer name (TSP03) I CO006 I
+-------------------+----------------------+-------+
I LEFT MARGIN 'xxx' I Printer name (TSP03) I LMxxx I
+-------------------+----------------------+-------+
I FUNCTION 'yyyyy'  I Printer name (TSP03) I yyyyy I
+-------------------+----------------------+-------+

If (according to table TSP03) a particular printer type does not support a particular option in table T022D (i.e. there is no entry), this option is ignored when printing. For further details, please refer to the documentation for tables TSP03 and T022D.

Variant 2

PRINT-CONTROL INDEX-LINE f.

Effect

Ouputs the contents of the field f as an index line in the current print output. An index line usually contains only administration information for archiving and is not output when printing. If no print mode is active, the statement has no effect. If the WRITE statement has already begun a print line, the index line is output after this line.

Example

DATA: INDEX_LINE(200).
PRINT-CONTROL INDEX-LINE INDEX_LINE.

Additional help

Print Control