Saturday, April 25, 2020

How to Print QRcodes, Data Matrix, Aztec Codes, Maxi Code and Han Xin Barcodes in SAP

Updated Device Types for Printing 2D Barcodes In SAP

Almost 10 years ago I published a blog that covered the process to print 2D Barcodes in SAP with the Barcode Writer In Pure Postscript, the following link focused on QR codes.

I have now updated some device types with the latest BWIPP code and combined 5 2D barcodes into one SAP device type. This allows all 5 standard variants of these barcodes to be printed in one process. I will publish further blog posts with dedicated device types for each individual 2D barcode later.

YouTube Video Demo

A change to the original blog is that I now use PDF24 as my barcode printer of choice rather than cutepdf.

The actual 2D barcode generation is still via integrating Terry Burton's Barcode Writer in Pure Postscript (BWIPP) project into SAP device types
BWIPP home page link -

I will break down the process into the following steps.

1) Download the SAP 2D Barcode Device type and Example ABAP code here

Extract the zip file and two files will be available

ZBWIPP2D = The SAP Device Type
Z2D_PRINT = demo ABAP code to print 2d barcodes

2) Import Device Type

Transaction SPAD & Select the below menu options to import the ZBWIPP2D device type

I am using SAP GUI 7.6 on my demo SAP NPL 7.52 trial system
Enter the Device Type NAME = ZBWIPP2D
Select Execute and a prompt will allow you to select the ZBWIPP2D.PRI file from the download

3) Install PDF24 

The PDF generator needs to process postscript so standard Windows 10 pdf printer is not sufficient for front end printing of these 2D barcodes from SAP.
SAP will send postscript output to be processed and PDF24 can do this for us. You can use CutePDF as well as other software, if you google there are a few options for this requirement to print postscript

PDF24 homepage
Download link

I used this version for my blog post but later versions can be used.

PDF24 Creator uses the free PDF interpreter Ghostscript , which is automatically installed as a private instance for the PDF24 Creator.

Following all standard options I have a PDF24 printer available

Check the following settings for PDF24 - there are many options but for this blog
Start PDF24 and select Settings

For this blog the settings are as follows- others are left as default

4) Create Output Device - in my example use the name FRONT2DC

Transaction SPAD -> Output Devices -> Display
Change to Edit mode and Create the following

Name = FRONT2DC 
Short Name = F2DC
Device Type = ZBWIPP2D    (created in step 2)

Host Spool Access Method = G: Front End Printing with Control Tech.
Host Printer = PDF24


5) User defaults to print now so output will be processed immediately
(make sure it is set, log off and check it again :)

6) Import ABAP Demo Code 

From transaction SE38 create ABAP report Z2D_PRINT.
Cut and paste the text from the downloaded file Z2D_PRINT 

Activate - ignore any warnings for NEW-PAGE PRINT ON, this is purely used as a simple method to allow the ABAP code to use the printer controls in the device type.

Now run the report Z2D_PRINT

Select Output Device FRONT2DC (the device created in step 4)
Select the tick mark

Select OK to Print to PDF24 device.

Select “Save as PDF” in the PDF24 assistant screen.

7) The actual 2D Barcode PDF document should look something like this....

Adapt the code as required the print controls are key to create the barcodes.

Obviously the individual 2D barcodes can be printed independently of each other.


Google +