TEC-IT
TECIT
Share!

FAQ: TBarCode/SAPwin - SAP Barcode DLL

FAQ for TBarCode/SAPwin - TEC-IT's Barcode DLL for SAPsprint, SAPlpd and SAPGUI.
 

Installation

What are the Basic Installation and Configuration Steps?

You must use at least one of the Spool Transfer Programs SAPsprint or SAPlpd - or the SAPGUI (Windows) Client.

Using SAPsprint

  • Install TBarCode/SAPwin in the SAPsprint installation folder.
SAPsprint is a Spool Transfer Software from SAP (see OSS Note # 894444) designed to be used on a print server (Windows platform).

No SAPsprint installed?

  • Using Windows Client (local printing), install TBarCode/SAPwin on the SAPGUI SAPlpd directory or on the directory where you can find the SAPwin.dll.

Configuring SAP

  • Copy the device type SWIN to ZSWIN.
  • In SPAD, add a new printer or modify an existing printer (e.g. your local printer), use ZSWIN as device type. The host spool method can be F (Frontend), G (GUI) or S (Server/SAPsprint) but not U.
  • Print the test document SAPSCRIPT-BARCODETEST available on client 00. You should see bar codes on the print-out by then.

For more detailed instructions, read the TBarCode/SAPwin Manual.

Device Type

How can I Export a Device Type?

  • Enter transaction SPAD
  • Main Menu: Utilities --> For Device Types --> Export
  • Object Selection = Device Type
  • Enter the name of the device type into the input field [Object Name]
  • Click Execute or press F8
  • In the following dialog enter (or confirm) the path where the export file should be saved

Device Type

How can I print Chinese characters?

Please look at SAP OSS Note # 83502.

In your SAP system there should be a device type CNSAPWIN for printing Chinese characters.

  • Make a copy of it and adjust the Printer Barcodes (transaction SE73) as shown in our manual.
  • Then assign this device type to your printer (transaction SPAD).
For TBarCode/SAPwin you need a device type based on the SAPwin device driver!

Unwanted Characters

Unwanted Characters are Printed Beside the Bar Code

Wrong defined print control suffix SBS01:

Please read FAQ section 21.8 of the user manual to learn how to solve this problem.

No Barcodes

No Bar Codes on the Printout

  • Wrong host spool access method,
  • Wrong device type,
  • Wrong print controls

Please read FAQ section 22.5 of the user manual. Make sure you have the actual version of TBarCode/SAPwin installed.

SAPsprint

Wrong Printing Order

From the command line, turn off the print job based multi-threading

sapsprint -oi ProcessingMode 1

* This parameter is supported in SAPsprint 1015.

Read SAP Note 1054561 for problems with printing sequence caused by multi-threading.

No Bar Codes after Heavy Traffic

Some users are printing at the same time large print jobs via SAPsprint. After the end of a such a print job containing bar codes, the bar codes on subsequent print jobs are missing.

  • This may be caused by multi-threading. See previous solution Wrong Printing Order....

Some bar codes are licensed, some bar codes have demo text

  • Use the latest version of TBarCode/SAPwin
  • Check if you have multiple versions of the barcode.dll and/or barcode.ini file in your system. You should use only one version. Make sure that the license key is in all barcode.ini files.
  • See previous solution regarding multi-threading.

SAPsprint Crash

SAPsprint Print Job Terminates with CreateDCW

OSS Note 1069483 -"Error: CreateDCW failed: The operation completed successfully".

This error is caused by a third party print monitor.

The following options in SAPsprint Version 1018 and later can deal with the CreateDCW error:

  • The service restarts automatically once the
    CreateDCW is one of the first calls to the printer driver. If this fails, you will not be able to print. With the Windows printer driver, the Windows spooler can create the final print job and then use the print monitor to transmit the print job to the printer.
    CreateDCW
    problem occurs. You can prevent this behavior by setting the parameter values to 1.
            Key: IgnoreDCError
            Default: 0
            Other values: 1
    
  • The SAPSprint service restarts automatically after a specified number of print jobs. This mainly reduces the occurrence of the CreateDCW problem described in Note 1069483. If the default value is set to 0, this service will not restart.

            Key: RestartAfterJobs
            Default: 0
            Other values: any number
    

For printing problems, Microsoft recommends the procedure that is described at http://support.microsoft.com/kb/260142/EN-US/

Or try to update or downgrade the printer driver / printer port software. Not always newer versions give better results - sometimes elder drivers are more stable. A printer with PCL emulation can usually use a standard HP Laserjet 4 PCL-5 driver as well. It is also possible to use a standard Adobe driver for PostScript emulation.

Printer Driver

Distorted Barcode Image

This behavior is most often caused by the Windows printer driver.

  • Get the latest version of TBarCode/SAPwin.
  • Change the drawing method in the barcode.ini file:
     [DRAW_MODE]
     UseGDIRect=1
    
    When using SAPlpd, make a restart.

You can also try the following:

  • Print bar-codes without human readable text: Set A=0 in the printcontrol Prefix of your printer barcode (edit it with TA SE73).
  • Change the printing direction: set direction=1 in the barcode.ini file.
  • Such problems may also be caused by multi-threading. See previous solution.

SAPlpd Crashes with > 352 Characters of Bar Code Data

Using SAPscript's rawtext command or the 2D barcode data concatenation, you can generate a bar code Printcontrol with a huge amount of data. But once you reach the limit of 352 characters, SAPlpd suddenly crashes. This is caused by a bug in SAPlpd, not of TBarCode/SAPwin.

As solution, use the data splitting feature of TBarCode/SAPwin to separate the data portions into 2 or more blocks. You can stay below the crash limit this way.

Barcode Position

How can I Fine Tune the Barcode Position?

Position may be:

  • relative (no X/Y parameters specified in Printcontrol) or
  • absolute (X/Y parameters specified in Printcontrol)

Additionally you can change the printing direction to print the barcode from base line upwards - see parameter Direction in the barcode.ini file:

Direction=1

If you print the barcode always to the same position you can specify X and/or Y parameters in the Printcontrol.

  • If the bar code should always be printed at the same position, you can set the target coordinates with the parameters X=[mm],Y=[mm] in the Printcontrol:
    bC=39,X=100,Y=50,B=50,H=20,D=
    The print control prefix can be modified in transaction SE73 (printer bar codes). Click the prefix, and then the button Maintain PrintControl. After that, a window will be displayed allowing you to change the character sequence.

If the barcode should be printed on a relative position (inline) you can use the shift parameter to fine-tune the Y position of the bar code. The shift parameter was introduced to overwhelm printer driver problems or to make relative positioning compatible with other (previous) solutions (e.g. hardware barcode printer extensions).

  • In the Barcode.ini you have to set the direction parameter to 1, after that you can use the shift parameter to adjust the vertical bar code position, wherein a negative value is also allowed.
    [SETTINGS]
    Direction=1
    Shift=1
    

Barcode Size, Barcode Rotation

How can I Change the Size of the Bar Code?

You can change the bar code size and orientation in the Printer Barcode Printcontrol Prefix. The following parameters are available:

  • B= ... controls the width of the symbol in mms
  • H= ... controls the height of the symbol in mms
  • M= ... controls the module width of the symbol (in 1/1000 mms)
  • R= ... adjust the orientation of the barcode in degree (optional)
* If parameter M is used, omit the B parameter!

Examples

  • Width: 70 mm, Height: 30 mm, Rotation=90°
            bC=E128,B=70,H=30,A=1,R=90,D=
  • Module Width: 0.254 mm, Height: 30 mm
            bC=E128,M=254,H=30,A=1,D=

You can edit the Printcontrol Prefix in transaction SE73 (printer bar codes).

  • Select your device type e.g. ZSWIN. In the edit dialog, click the prefix and then the button Maintain Printcontrol. Change the Printcontrol parameters in the Control Char Sequence input field.

Log File

Barcode Log File Coordinates

The following sample describes the barcode position parameters you can see in the barcode.log file:

  • Printcontrol parameters are shown first, e.g:
    C=128B,B=43,H=7,X=0,A=0,D=
    
    The X position in our example is zero. The Y position is not specified, so it will be taken from actual cursor position by default.
  • The next parameter is the actual printing cursor position passed from SAP to our DLL. This value is relevant for relative positioning:
    Pos:        xpos: 240, ypos: 2050
    
  • And then the bounding rectangle of the barcode:
    Start point: x: 0, y: 2215
    End point:   x: 1016, y: 2050 
    
    The zero-zero point (origin) of the coordinates depends on the used mapping mode. The origin can either be the top left corner or the bottom left corner of the document.

Decoding Problems

How can I Optimize the Bar Code Quality?

The bar code module width parameter influences the reading quality of the bar code.

Note: Use standard settings for the
Print ratio is the ratio of bar widths and spaces
print ratio e.g. Code-128 has a ratio of 1:2:3:4.

Example: 200 dpi printer

If the printer prints with 200 dpi, set the module width so that it corresponds exactly with an integer multiple of the width of one or more printer pixels. For example, use 1 pixel (which is equivalent to 0.127mm in this case) for 200 dpi.

According to most symbology specifications, a module width below 0.19 mm should be avoided. In such a case, at least 2 printer pixels should be set for bar codes to achieve a module width of 0.254 mm.

If the module width is too small, the bar code width is also too small. Use the following settings:

        3 x 0.127mms = 0.381mms
        4 x 0.127mms = 0.508mms

Conversion table for millimeters to inch:

        0.127 mms  =  0.005 inch (to small)
        0.19  mms  =  0.007 inch (minimum m.w.)
        0.254 mms  =  0.010 inch (2 printer pixel)
        0.381 mms  =  0.015 inch (3 printer pixel)
        0.508 mms  =  0.020 inch (4 printer pixel)

Set the module width based on the above values to avoid resolution errors. If errors still occur (because of minor rounding errors), try using 0.509 instead of 0.508.

You can also use Barcode Studio with the Quality Watch feature to detect printing tolerances and find out the optimal module width value.

For 203 dpi printers see the next FAQ

Barcode Quality

Barcode Quality Problems with 203 dpi Printers (Zebra etc)

You may encounter bar code quality problems when printing to a thermal transfer printer with 203 dpi

Adjusting the module width to the printer resolution is the standard solution for such problems. But with 203 dpi printers we have one particularity shown be the following example.

Three printer dots at 203 dpi correspond to 0,3753694581 mm. But the module width in the Print control can be adjusted to 0.375 mm only (no more fractional digits can be specified). This approach leads to an aberration of 0.000369 mm per bar/space module in the symbol. This sounds like a very small error, but the errors add up and lead to an aberration of one or more printer dots when printing wider bar codes.

Solution

With the OptResolution flag the module width can be reduced to the next full pixel boundaries thus reducing the printing tolerance to a minimum.

  • Edit the barcode.ini configuration file and adjust:
    [SETTINGS]
    ...
    DefOptResolution=1
    
  • Adjust the module width in the Print control slightly above three Pixels: M=376.

This way the Barcode DLL will calculate a "fallback" module width of 0,3753694581 mm (according to 203 dpi) thus avoiding the aberration mentioned above.

FNC1

EAN-128 Variable Length AI With FNC1

  • Use system barcode BC_EANH or a user specific type ZBC_EANH
  • Make sure that you configured the EAN-128 bar code format in your print control Prefix as follows:
    C=E128,...
    
  • Adjust a placeholder for the FNC1 with the print control parameter %=. Use a placeholder, which is normally not used in AIs - e.g. the exclamation mark %=! or the plus sign %=+
  • Then encode the FNC1 using the placeholder (e.g. the exclamation mark):
    21 + serial number + ! + 11 + production date.
    
    If the serial number is 1234 and the production date is 010108, the encoded bar code data should be as follows:
    211234   FNC1   11010108
    
  • Check if everything works by scanning the bar code with a reader. You can also send your bar code (image scan or PDF) to TEC-IT Support for validation.
EAN128 uses FNC1 character on the first position of the code to mark the bar code as EAN-128 and identify it from Code-128. This is done automatically by TEC-IT Barcode Software, so you don't need to do it manually!

Silent Setup

How can I run a Silent Setup With TBarCode/SAPwin?

The setup for TBarCode/SAPwin is based on MSI where we have a "quiet" option available. Call the MSI package with the following command line parameters:

msiexec /i TBarCode_SAPwin.msi INSTALLDIR="C:\MyInstallDir" ADDLOCAL=Feat_Bin \qn
Declaration of parameters:
/i  .............................indicates which package is to be installed
INSTALLDIR  .........sets the installation directory
ADDLOCAL  ...........indicates which features are installed (ADDLOCAL=Feat_Bin   
                                 installs only the Barcode DLL without user manual)
/qn  .........................quiet Installation (No Dialogs)

Other supported parameters you will find here:
http://technet.microsoft.com/en-us/library/cc759262.aspx

Note: The files "SAPlpd.exe" or "SAPwin.dll" must exist in the destination directory, otherwise setup aborts. In quiet mode, all errors are suppressed.

Data Matrix

Insert a Data Matrix Barcode into your SAP system

Here are the steps to insert a Data Matrix bar code into your SAP system.

Precautions

  • Make sure you have a copy of a SAPWIN based device type (e.g. copy device type SWIN to ZSWIN – see our manual 6 Create a Device Type Copy).
  • Assign this device type to a printer – see manual 7 Assign the Device Type to a Printer.
  • You can test your TBarCode/SAPwin installation by printing the SAPSCRIPT- BARCODETEST (client 00) - see our manual 9 Test Barcode Printing.. If this SAPscript document does not exist you can request it from our support.

Add Data Matrix System Bar Code

  • Use Transaction SE73 – System Bar codes (see manual 12.2.1 New System Barcode). Add a new system bar code (name space Z... e.g. name = ZDATMAT).

Define Data Matrix Printer Barcode

  • Enter Transaction SE73 – Printer bar codes. Follow the steps in the manual section "8 Define Printer Barcodes".
  • Select ZDATMAT and add a new prefix for it (e.g. SBP90), as for the suffix you can use the existing suffix SBS01.
  • Edit the prefix (SBP90) and enter the control sequence: bC=DMX,M=508,D=

    Make sure that the prefix Variant is set to 5, you can change that in transaction SPAD. The Printcontrol must be marked Extended (see manual 21.4.4 Wrong Variant of Print-Control Prefix.)

Add Data Matrix Character Format (Style)

There are multiple ways to insert a barcode into your form (see manual 11 Using Barcodes in SAP). If you decided to use a bar code character format (preferred way), you have to add ZDATMAT as new available character format to your style.

  • Edit the style you have assigned to your form and add ZDATMAT as new barcode character format.
  • Use transaction SE72 for editing SAPscript styles.
  • Use transaction SmartStyles for editing SmartForm styles (see manual 11.2.2)

Host Spool Access Methods

Wrong Host Spool Access Method (HSAM)

Destination computer is not available (HSAM "S")

Please keep in mind that computer and printer name are case-sensitive! Cross-check test: Use the IP address instead of the host name.

In case of thermal printers (like TEC-B482): No ribbon feed.

Use the host spool access method “S” instead of “F”. Therefore you’ll need the name of the computer on which SAPlpd is running (make sure that SAPlpd is already running, SAPlpd does not start automatically when using HSAM “S”!). The share name of the printer is to be indicated as follows:
"\\SAPlpdHostName\PrinterShareName".

PDF

No Bar Codes with PDF Printer in SAP!

There is a difference between printing and PDF generation in SAP:

Printing

The barcode is generated during the spooling process to the printer. The print job is routed through SAPGUI, SAPlpd or SAPsprint and these programs call our Barcode DLL for barcode insertion.

PDF from SAP

With PDF it is different - the SAP PDF Generator generates the PDF completely on the server and here we have no possibility to insert the bar code. SAP PDF inserts no barcode, only a text note.

Combination Printing + PDF

The only solution for generating PDF documents with real visible bar codes is a Windows PDF printer software. You print to this printer like a normal printer but the driver of this software generates a PDF instead of a print out.

PDF Printer software is available from several vendors. You should select a tool, which allows server operation and is not dialog based (= generates PDF document names and stores PDF files automatically).

Adjusting a sufficient image output resolution (600 dpi) in the PDF driver is important to get readable barcodes.

© TEC-IT Datenverarbeitung GmbH, Austria  ++43(0)7252/72720  office@tec-it.com