By | December 28, 2021

Sage X3 provides us a functionality to print labels and barcodes using ZPL printer. ZPL stands for zebra programming language and using this language we can design the layouts of labels and embedded barcodes. In this blog we will see how the ZPL setup is configured in Sage X3. Below are steps to configure ZPL.


Create a layout of document (.pat file) using zebra programming language.X3 Zebra Printing uses a ZPL Pattern file to determine the layout of the output. The information can be plain text, static text, formula based on X3 fields, barcode based on X3 fields or the data of X3 fields.

After creating this .pat file, locate it to PAT sub-directory of sage X3. For example if we are configuring in SEED folder (D:\Sage\X3V12\folders\SEED\PAT).

PAT directory path
Fig01: PAT directory path

Navigate: Development -> Script dictionary -> ZPL reports.

Enter the setup code and description. Enter the ‘file template’ field, here we have to enter the name of .pat file which is placed in PAT folder. To import the contents of the .PAT file, click on the File template’s Actions icon and select “New model version” – the Version number will be displayed and the internal counter will be incremented so the next import will have a distinct Version Number.

Template file
Fig02: Template File

Please note that the Pattern will not be used until the ZPL Definition has been Saved, so make a small change to the Description such as adding a space so that the Save action is available – if an earlier Version exists, that will be used instead.

The runtime selection criteria set up in Report Parameters, as described later, are used to select the data to be included in the Report.

Fig03: Criteria

In the above case, ARZIMP.PARAM(“commandedeb”)  function provides a link the value specified in that Parameter at run-time – in this case, as defined in Report Parameters within Dictionary > Script dictionary > Reports

ZPL Patterns have three main sections, Header, Detail/Line and Footer/Tail.

Structure of template
Fig04: Structure of Template

Please check that the .PAT has been imported correctly. Click the Action icon of the Template file field and select “View template” action. Check that Header, Lines and Base have ZPL commands in them – if all three tabs are not populated, this implies that the sections are not defined properly and should be reviewed.

There is an ‘expression’ tab in ZPL report screen. As shown below here we can add the execution condition and the expression as required.

Fig05: Expression

Creating a ZPL Report

After setting up the ZPL Printer to hold the ZPL Pattern, an X3 Report should be set up to run the ZPL Printer Report. This is done in Development > Script Dictionary > Reports.

This is where the ZPL Printer is associated with an X3 Report, the ZPLPRINTER Destination and Report Parameters which select the data to be output.On ticking the “ZPL printer” field, the “Parameter Code” field becomes active and this is where the ZPL Printer’s Code is entered.

Specify the Zebra Printer’s Code in the “Destination” field.

ZPL report
Fig06: ZPL Report

On the Parameter definitions tab, specify the parameters which will be used by the ZPL Printer.

Fig07: Parameter grid

Hence after creating the ZPL report when we will print our ZPL report we will get the output as the layout is designed with ZPL language.