Use of PRINT-CONTROL in SAPscript

     SAP Note No. 66478 

     Symptom
     What do I have to bear in mind when using the PRINT-CONTROL command in SAPscript texts or forms?

     Additional key words
     SAPscript, PRINT-CONTROL, printer control, bar code
     Cause and preconditions
     Information requirement in addition to the documentation
     Solution
     The PRINT-CONTROL command in SAPscript (see note 5196 or ABAP/4 syntax
     documentation for the command PRINT-CONTROL) was implemented so that it
     is possible to include printer-specific commands in SAPscript texts and
     forms.These commands are used to call special functions on the printer
     or output device that are not supported by the existing SAPscript
     printer drivers. PRINT-CONTROL enables you to modify the print data
     stream created by the SAPscript printer drivers within certain limits or
     to send additional commands.
     The SAP standard (or standard forms of the SAP applications) does not
     use any print CONTROL commands in SAPscript, because these are always
     printer-specific and may lead to unforseeable consequences as well as
     problems during the upgrade.
     Information on using the command PRINT-CONTROL in SAPscript texts or
     forms.

     The print control, which is issued via the PRINT-CONTROL command, should
     always be a print control created in the customer namespace (Zxxxx) for
     the device type used. You should not use any Sxxxx print controls as
     their contents may change at any time due to SAP release and driver
     updates. Refer to note 3166 for information on how to modify SAP device
     types.

     The printer commands contained in the print control should not affect
     the current printer settings because the SAPscript printer driver does
     not have any information regarding the changes that may be triggered by
     a print control and that would, therefore, have to be reset by
     printer-specific commands. The printer driver assumes that the print
     control does not affect the texts/graphics issued subsequently.

     You should never use PRINT-CONTROL for controlling print attributes
     already contained in the SAPscript driver. You must change these
     attributes in the normal way via the form or style definitions and the
     definition of device types.

     In particular, you should never use PRINT-CONTROL to change the current
     font, font attributes (such as Unterline, Bold, and Italics), paper
     tray, print mode (one-sided/double-sided), current character set, print
     position, text color, coordinate system, page orientation, and so on as
     this may affect the print output of any subsequent regular text. In each
     case, the particular text/form author using PRINT-CONTROL is responsible
     for the consequences of using the function.

     SAP cannot provide any support for print output errors caused by
     PRINT-CONTROL commands or implement program modifications in the SAP
     standard due to these errors.
     The recommendations of this note are equally valid for ABAP lists (and
     the use of the ABAP PRINT-CONTROL command).

     The following example makes clear why using PRINT-CONTROL is "dangerous"
     in SAPscript:
     In the window of an SAPscript form the following text is entered:
     /: PRINT-CONTROL ZPRCT
     =  command

     In this case you expect that the contents of the print control ZPRCT
     will appear and directly afterwards the text "command" (at least for
     device types operated with HPL2 (PCL-5) or STN2 (line printer) during
     the print output of the form window. However, this does not have to be
     the case!For the SAPscript printer drivers, the first text to be printed
     in this form window is the string "command" since the driver does not
     know what is triggered by the data contained in the Printcontrol ZPRCT
     at the printer.For this reason the printer driver may first send the
     contents of the print control ZPRCT, then execute a character set
     selection and/or the font selection (to choose the current font) and
     after this, send the string "command".In this case, print commands are
     sent by the driver to the printer between the print control and the
     string "command"!
     You basically cannot rely on the printer driver not to insert print
     commands between PRINT-CONTROL xxxxx commands and "normal" text in a
     SAPscript text.
     Source code corrections
     ________________________________________________________________________
 

     Note is release independent
     Further components

     BC-SRV-SSF
      Smart Forms
     ________________________________________________________________________

     Reference to related Notes

     Number    Short text
     ____________________________________________________________
     400379    Output with PRINT-CONTROL does not work
     ________________________________________________________________________

Read Also
Mass Idoc Change Corrections

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.