QR and Barcode printing on Zebra printer using SAP (Smartforms, Adobeforms) or ZPL(Zebra Programming Language)

Ahmet Acar
6 min readMar 16, 2021

A s can be understood from the title, I will talk about in my article today is how barcodes and similar things (like QR Codes or Data Matrix) are made from Zebra printers using SAP Smartforms/Adobeforms or ZPL.

Zebra Barcode Printer

Before starting the subject, let me explain to you the logic of doing both ways. First, I will give some information about the working logic of ZPL. Only Zebra printers can decode the written ZPL codes and the written code turns into a meaningful printout on the printer, it is seen as just a stack of code until it reaches the printer.

ZPL is a programming language used for Zebra printers. You can learn this programming language from the document shared by the zebra for software developers on its site, or you can design your own barcode using the Zebra Designer Program and extract it directly from the Zebra printer or save it to the file and view it in TXT format then you can see that ZPL codes. Moreover, you can view the ZPL codes written on the Labelary website.

Whereas, if you want to apply this process in Smartform and Adobeform, you have to handle all process on SAP and you will see the output in the print preview. On the other hand, printer applies only the barcode printing process, there is no extra operation on it.

I can explain with example for Adobeform:

1- Use transaction code SFP. Enter the Interface and press on Create (Interface is mandatory for Adobe form).

SFP

2- Enter the Description and Press Enter.

Create Interface

3- Enter the Package name and Save. Below Screen appears.

Change Interface

4- Press on Create button to add an importing parameter. Add V_AUFNR which is of type AUFNR and check the optional Flag. Check, Save, Activate the Form Interface.

Add new parameter

5- Back. Enter the Form name and Press Create button.

Create Form

6- Enter the Description and Interface name which we created earlier.

Create Form-2

7- Enter the Package name and Save. Following screen appears.

Form Builder

8- Open the import Parameter and Drag and drop the required variable to Context.

9- Then Press on Layout Tab. The following screen Appears.

Layout

10- Drag and Drop the Field which you wanted to print on the form to Design view. You can place this field anywhere in the layout.

Data View to Design View

11- There will be a Toolbar with the name: Object Library. If you are not able to find go to Palettes -> Object Library. In the Toolbar, look for Barcodes option. Expand it. Below are the different types of the Barcodes. Usually, we use Code 128C — but it can change based on the country and requirement.

Object Library->Barcodes

12- Drag and drop the Code 128C Barcode to your Layout.

Code 128C

13- Go to Data Binding, Bind the Order number: V_AUFNR.

Binding

14- Place a Heading (Text) on the top (not mandatory): BARCODE GENERATION EXAMPLE: Ahmet Acar

Barcode Example
QR Code

Check, Save and Activate the Form. We are done placing the Barcode and QR Code, Binding it to a data source. It is that simple. Isn’t it?

To see output for test purpose. go to SFP and give your Form name. Press F8 and give some value to importing parameters, just like you do for function module and see the output.

That was all for the Adobeform part. If the printer settings have been applied in your system, when you call the relevant Adobeform, you can see this output from printer.

On the other hand, we can use Zebra code in Smartforms or Adobeform. In this example, we will use Smartforms.

I will explain through the example on Labelary website. When you first open the site, you will see an example. On the right side, you will see the output sample of the labels and on the left side, you will see the ZPL codes of this example.

http://labelary.com/viewer.html

We could use just code part in smartforms. I’m not explain details this code parts, because those codes explain very detail in ZPL document. For example, I’m just write a comment part, use starting line (^FX) code or use text(^FT) code. I’m suggesting you to try this part a lot and learn by mistakes.

Smartforms

In this example, I’m doing my experiments on the site, I will see the output images of the barcodes and apply it to my own production in smartforms. As you know, when previewing the output with ‘LP01’, you will only see the codes. Only the Zebra printer can decode them.

Otherwise, we can use ZPL Designer Program creating barcodes,QR codes etc.

Zebra Designer

Firstly, sorry for using the program in Turkish, if there is a point that you are stuck, I will reply if you ask in the comments. In this example we will use the QR code. I’m click the barcode button on the left panel and then put on the screen.

In this section, I write the value ‘Ahmet’.

Second part, I’m choose barcode type ‘QR’.

To view it as ZPL code, follow the steps below:

Press File button

  1. Press Print button.
  2. Click Print in Folder checkbox.
  3. Press Print button on the up side.

We must save file PRN format.

Then open with Notepad++

As you can see, ZPL code appeared.

Thank you for reading. Stay tuned!

What do you guys think? I love to know your thoughts. Kindly like, share or comment below.

Ahmet Acar.

--

--

Ahmet Acar
Ahmet Acar

Written by Ahmet Acar

SAP ABAP Developer, Computer Engineer, Amateur Basketball Player.

Responses (2)