To determine the print format, use the PRINT-CONTROL statement:
Syntax
PRINT-CONTROL formats [ LINE lin ] [ POSITION col ].
Without the options LINE and POSITION , this statement sets the print format specified in formats for all characters that are printed starting from the current output position (system fields sy-colno and sy-linno ). The LINE addition sets the print format to start from line lin . The POSITION addition sets the print format to start from column pos .
In formats , you can specify several different print formats. The system converts the values into a printer-independent code, the so-called print-control code. When printing, the system translates the print-control code to printer-specific control characters of the selected printer.
The table below lists the valid formats additions and the corresponding print-control codes:
formats |
Code |
Meaning |
---|---|---|
CPI cpi |
CIcpi |
Characters per inch |
LPI lpi |
LIlpi |
Lines per inch |
COLOR BLACK |
CO001 |
Color black |
COLOR RED |
CO002 |
Color red |
COLOR BLUE |
CO003 |
Color blue |
COLOR GREEN |
CO004 |
Color green |
COLOR YELLOW |
CO005 |
Color yellow |
COLOR PINK |
CO006 |
Color pink |
LEFT MARGIN lfm |
LMlfm |
Space from the left margin |
FONT fnt |
FOfnt |
Font style |
FUNCTION code |
code |
For directly specifying a code |
There are many more print-control codes than formats additions. Therefore, you can specify any print-control code directly using the FUNCTION addition.
Use the print formats only to set formats that are either not possible or not reasonable when formatting output for the output screen (for example, size specifications or fonts). You should set all other formats as described in Formatting Options or Formatting the Output . These formats automatically apply for printing as well as for display (provided the specified printer supports them).
To find the codes supported by a certain printer, choose Spool Administration (transaction SPAD).
. This takes you to the screenChoose the individual components to receive the following information:
Selection |
Information |
---|---|
Output devices |
List of the installed printers, including the device types |
Device types |
Description of the device types |
Standard print control |
List of the print-control codes |
Print control for device type |
Assignment of printer-specific control characters to the print-control codes for each device type |
Page formats |
List of page formats |
Paper types |
List of valid formats |
Device initialization |
Assignment of formats for each device type |
Display Print control for Device Type to find the print-control codes available for the printer you want to use. From the displayed list, select the desired device type.
Here you can see whether printer-specific control characters are maintained for a print-control code. Choose Info to display additional information for the individual codes in a dialog window.
For more detailed information about spool administration, refer to the SAP Printing Guide (BC-CCM-CRM) .
The following executable program is connected to the logical database F1S.
REPORT demo_list_print_control LINE-SIZE 60. TABLES spfli. PRINT-CONTROL FUNCTION: 'SABLD' LINE 1, 'SAOFF' LINE 2, 'SAULN' LINE 3. GET spfli. WRITE: / spfli-carrid, spfli-connid, spfli-cityfrom, spfli-airpfrom, spfli-cityto, spfli-airpto.
If in table T02DD, the printer control characters for the print-control codes SABLD, SAOFF, and SAULN are defined as in the figure above, the system formats the output as follows:
1996/03/13 SPFLI 1 ------------------------------------------------------------ AA 0017 NEW YORK JFK SAN FRANCISCO SFO AA 0064 SAN FRANCISCO SFO NEW YORK JFK DL 1699 NEW YORK JFK SAN FRANCISCO SFO DL 1984 SAN FRANCISCO SFO NEW YORK JFK LH 0400 FRANKFURT FRA NEW YORK JFK ....
....
The print format for the first line is set to bold, using the print-control code SABLD. The print-control code SAOFF turns off bold style, starting from the second line. Using the print-control code SAULN, the system underlines all lines starting from line 3.