Create New print list format for a Device Type
Few days back my customer wanted to add new ABAP list formats (Z_95_170) for a certain device type because they do not like the font or line spacing and other settings.They wanted to have a pretty layout.I tried to read SAP standard documentations,Notes and thought of putting them here in this document.
Formats specify how output is to appear on paper. As format names suggest, the basic specification that a format makes is the size of the paper that is to be used.
There are three types of spool printer drivers in the SAP system:
· Format types used by SAPscript. The standard formats are named after the page format used.
· Format types used by the spool system for list output. The names of the standard formats begin with an X.
· Format names beginning with G are reserved for SAP Business Graphics.
Here in my case I created a new format for list output.
The SAP standard formats for list printing specify in their names how many lines of how many characters can be printed per page. For example: X_65_80 (print 65 lines 80 characters wide per page); X_65_120 (print 65 lines 120 characters wide per page).
Customer wanted to have format type Z_95_170 in our scenario.
1. Execute Transaction code SPAD (Spool Administration)–> Full Administration and then Format Types on the Device Types tab page
2. To create your new format, click on the Display button beside “Format Types”
3. On the next screen choose Change and then Create or Create using template.
Give the format a name starting with Y or Z (the reserved namespace for customers). This avoids conflicts with SAP standard formats. Please follow SAP recommended naming conventions for list formats: Y or Z_<LL>_<CC> where <LL> is the number of lines to print on a page, <CC> is the number of characters to print on a line.
3. Select Format type for ABAP lists/L for the field Type.
4. Enter ANY as the page format if you do not want to specify the page format.
5. Enter the line and column number of the area to be printed.
6. Optional: Select List Driver if your format is to be used for device types that use one of the list printing drivers (copies of device types HPLJ4000, KYOFS170, and POST2). Choose Enter.
Note that the page format you selected (L or S) also exists with the orientation that you set for the format. If this is not the case, the system displays an error message.
7. Save your entries and it will prompt for a Transport Request.
8. Now If you go back to previous screen and Refresh this new format will be visible.
To complete the implementation of a format, you need to define a device type format for the new format and assign this format type.
9. Execute Transaction code SPAD (Spool Administration)–> Full Administration and then Format Types on the Device Types tab page
10.Select DEVICE TYPES and Pick your device type.
11. Select the FORMATS icon on the menu.
Verify your newly created format is on the list.If it is not there.Click on Create and select it.
12. Double click on the new format or It will automatically take you to the Maintain Format screen as shown below
13. Edit the code behind Printer Initialization,Reset after page, End of page, End of line one by one
I am giving my code here.That may give you some idea.
Now edit the action “Printer intitialization” by Double clicking on Action “Printer initialization”
# Device Name Z_95_170
# SAPWIN indicatior makes it possible to send via berkeley protocol
# change WinCharSet to 136
# set font name(MingLiU)
# set orientation(LANDSCAPE)
# set font size(6.0points)
# set vertical spacing(11.7LPI)
# set horizontal spacing(19.0CPI)
# set top/left margin(0.5cm/1.0cm)
Now edit the action “Reset after exit” by Double clicking on Action “Reset after exit”
Format Type Code – Reset after exit
# Device Type Z_95_170
# No control codes!
Now edit the action “End of page” by Double clicking on Action “End of page”
Format Type Code – End of page
Now edit the action “End of line” by Double clicking on Action “End of line”
Format Type Code – End of line
Comments on the notation in the editor :
-Lines which begin with # are comment lines. Every printer command is usually explained by a preceding comment line.
\e stands for the ESCAPE character (=Hex $1B)
\n stands for the NEWLINE character (=Hex $0A)
\r stands for the CARRIAGE RETURN character (=Hex $0D)
\f stands for the FORMFEED character (=Hex $0C)
\s stands for the SPACE character (=Hex $20)
\0xYY stands for a single byte with hexadecimal value YY, e.g. \0xF0 stands for Hex $F0.
The following commands are used for almost every printer type:
– Setting for the character set used
– Page length, form length in lines or inches (<- you can modify this to get a smaller/larger page length for line printers with endless form feed).
– Perforation skip mode off
– Setting of line spacing (lines per inch, LPI) (<- you can modify this to get a larger/smaller line spacing)
– Font and pitch commands (<- you can modify this to get a smaller/ larger pitch or use a different font)
17895 – Adapting print list formats for customers