PRINT-CONTROL (ABAP Keyword)

PRINT-CONTROL is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.

PRINT-CONTROL

Variants

1. PRINT-CONTROL.
2. PRINT-CONTROL INDEX-LINE f.

Variant 1
PRINT-CONTROL.

Additions

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 lin
9. … POSITION col

Effect
Determines the desired print format for the subsequent characters, starting from the current output position.
You define the output position either implicitly:

Line 1/column 1 before the first WRITE output on the current page.
Line and column of the next field output with WRITE .

or explicitly:

Line 1/column 1 using NEW-PAGE ,
Line n/column 1 using SKIP TO LINE n
Line */column m using POSITION n (* = current output line).

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

Addition 1
… CPI cpi Letters per inch
Addition 2
… LPI lpi Lines per inch
Addition 3
… SIZE size Script size
Addition 4
… COLOR Color …
… BLACK black
… RED red
… BLUE blue
… GREEN green
… YELLOW yellow
… PINK pink
Addition 5
… LEFT MARGIN col Distance from left edge
Addition 6
… FONT font Set font
Addition 7
… FUNCTION f Reference 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 lin

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. This has 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

PRINT-CONTROL LINE 10 POSITION 70 FONT 5.

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.