Skip to Content
Author's profile photo umar jawid ahmed syed

How to Print Barcodes that are not supported by SAP using Smartforms


In this document we will work on printing a Data Matrix barcode (DMC) which is a 2D barcode not supported by SAP.

A 2D (two-dimensional) barcode is a graphical image that stores information both horizontally — as one-dimensional bar codes do — and vertically. As a result of that construction, 2D codes can store up to 7,089 characters and possibly more.

Below are some of the types of 2D barcodes



Print Data Matrix barcode (2D barcode) on zebra printers using Smartform.

* Similar approach can be followed for printing other 2D barcodes and the generic barcodes with specific height and width.


SAP by default only supports PDF417 as 2D barcode and does not support Data Matrix and other 2D barcodes


Printing other 2D barcodes which are not supported by SAP is possible by following the below steps

  • Printer should support the required barcode: We can check this online based on the printer model and make. Most probably you will find this information on the manufacturer’s website.


  • Choose an appropriate device type for the printer: Selection of device type is based on the printer you are using.  In this example we are using ZEBRA printer so the device type selction will be based on Zebra printer.This topic is dealt in more detail in the other document named ‘Working with Zebra Printers using Smartforms in SAP’ please refer to the same for additional documentation on selecting the device type for Zebra printers.  For Zebra printers we have the following device types LZEB* (* => 2/3/4) series or YZB# (# => 200/300/400) series based on the DPI resolution of the printer.

        For the demonstration as an example we will use LZEB2 device type from here on in this document.

  • Create a system barcode of type UNDEF in SAP: For creating a system barcode go to transaction SE73.

          This will take you to the SAP script Font Maintenance: Initial screen


          Select System barcodes check box and click the change button. This will display a list of all the Barcodes on the SAP system.

          Click the Create button (Paper icon) at the top of the screen


          The Choose Bar Code Technology select box will now be displayed.


          The barcode we are adding is a new barcode symbology which is not supported by SAP, and the new barcode techcnology allows only specif types

          of barcodes symbologies to be created therefore we are going to use Old technology to create our new barcode as an undefined symbology.

          So Click on Old.

          The Create/Change System Bar Code settings screen will be displayed. For barcode type enter ‘UNDEF’ ( barcode not defined) as the data matrix

          barcode type is not defined in SAP. Also specify the height and width of the barcode.


          Then save the changes by clicking on the Ok button. Now the system barcode ZDMC is created.

  • Create a printer barcode for the newly created system barcode with appropriate print control:

       For creating a system barcode go to transaction SE73. This will take you to the SAP script Font Maintenance: Initial screen


          Select printer barcodes check box and click the change button. This will display a list of device Types available in SAP system.



          In this case I am using device type LZEB2 so I will create a printer barcode for this device type. It is advisable to copy this device type to a new

             device type and then make changes to the new Z device type and use it for printing but for demonstration I am using the same device type.

             Double click on the device type to list the barcodes supported by this device type.


               Notice the Prefix and Suffix value ranges used for the barcodes. Here in this case the highest number used for prefix is SBP20 and is different

               for each barcode however the suffix is same for all the barcodes. These prefix and suffix are the print controls of the barcodes supported by

               the printer.

               Now select the create button on the top of the screen to add a new printer barcode. This will take you to the barcode selection screen.


               Select the system barcode you created earlier and enter the other values as shown in the screenshot above. For prefix we are entering SBP21

               because all the numbers from 1 -20 (SBP01 to SBP20) are already used so we are using the next available number SBP21 and the suffix number

               stays the same. We can use any number from 21-99 for prefix.

               Now the barcode is created for the device type (see screen shot  below)


               But the print control SBP21 is empty. For the barcode to work properly we have to add commands in the print control in ZPL-II language

               (printer language).

               Please find the online document named ‘ZPL2 command book‘ . The site link for the same is


               It is adviced to have the document before we proceed further. This command book has all the commands for printing different types of

               barcodes on a printer ( only if the printer supports it )using the ZPL2 command Lanugage.

               Here we are adding the Data matrix barcode, and the printer command format for printing the data matrix is: ^BXo,h,s,c,r,f,g

               Command Parameters:

               O – Orientation

               H – Height

               S – Quality level

               C – Columns to encode

               R – Rows to encode

               F – Format ID

               G – Escape sequence control character

               Refer to the attached command book for accepted and default values for the above parameters and how to use the command.

           Below is an example of the post script language commands used for printing a DMC barcode on the printer.


            The printer command mainly needs to have 3 types of information

  1.      Command to indicate the type of barcode to be printed ( Marked by ^BX in the command above)
  2.        Command to indicator the start of data ( Marked by ^FD)
  3.        Command to indicator the end of data (Marked by ^FS)

           When working with Smartforms the prefix print control in the printer barcodes screen should have both the commands for the type of barcode

               and the command for the start of data whereas the suffix will only have the command to mark the end of data.


          Taking the above points into consideration we will have ^BXN,2,200,20,20,6,~,1^FD command in prefix and ^FS in suffix.  As the suffix is

             used to mark the end of data it is same for all the barcodes and hence maintained as default.

             Meanings of the command Parameters for prefix ^BXN,2,200,20,20,6,~,1^FD are:

              ^BX        The Data Matrix command

              N            The orientation is normal

              2              Dimensional height in dots of the individual symbol elements

              200         Quality ECC level (ECC 200)

              20           Columns to encode

              20           Rows to encode

              6              Data to be used (6 means full 256 ISO 8-bit data is used)

              ~             Escape sequence for control characters

              1              Square aspect ratio, if you required rectangle this will be 2

              ^FD        This is to mark the start of the field data to be encoded in the barcode

            Add the following command in the print control prefix:  ^BXN,2,200,20,20,6,~,1^FD

            Go to SE73 -> Select printer barcodes -> Change ->Select device type (in this case LZEB2) -> double click to display the list of barcodes supported

            by the device type.


              Select the new print control SBP21 (barcode prefix) and click on Maintain Print control button. Following popup will be displayed.


              Enter the command in the control characters sequence field and make sure the Hexadecimal switch is turned OFF. Then press enter.

              The print control is saved.

               The barcode suffix SBS00, which is default for all the barcodes holds the end of data command (see below)


               The configuration of the printer barcode is complete. Now we can use this barcode to print the Data Matrix barcode (2D barcode) from SAP.


               There can be various combinations to the prefix command. If the barcode is not printed then you have to try changing the values for the height,

               rows and columns variables in the command. The prefix combination that worked for me is: ^BXN,3,200,,,6,~,1^FD


  • Use the barcode in the Smartform using a style:

       Please refer to online documentation for adding a barcode to a style in Smartform.

       After you have added the barcodes to one of the character formats of the style which is being used in the Smartform, we just have to use the

         newly created barcode type to display the 2D content as Data Matrix Barcode.

       See below screenshot for an example.


       As the example depicts, use a separate text node for the 2D barcode , keep all the 2D content in a variable or write it all down in the text node.

         Select the whole text and select the character format for the DMC barcode.


          At this point if you try to print the barcode it is expected to see the barcode on the printout, but you might not see the barcode printed on the

         printer, the reason as i understood is that based on the ZPL2 command the data should be marked with the start of data command and End of data

         command along with the type of barcode we are trying to print. so the commands should be inserted before and after the text node that holds

          the 2D data content. This will give the printer a command saying that the data between this is to be printed as the barcode symbology specified in

          the command, in our case Data Matrix.

          Note : Preview will not show the barcode because literally this barcode is not in SAP system and will only be printed on the printer. So anything

          concerning the barcode has to be tested on the actual printer not the preview because both the preview and the actual print will be a lot


  • Create a command node before and after the text node that holds the 2D barcode content:

       See below screen shots for an example on how to create a command node.


        Then enter the prefix print control we created in the printer control input field (see below).


       Create one more command node under the 2d content text node and enter the enter the suffix print control in the printer control input

         field (see below)


        Now test the print on the Zebra printer, the barcode should be printed on the zebra printer as shown in the screen shot below. Now take the

        printout and scan the barcode with any of the android apps or any barcode reader that support DMC barcode. Please note that the printout taken

        on your local printer from a scanned document wont be readable, so it is advised to test the barcode scanning from the actual printout or from the

        Scanned document on your computer.


        After scanning, the barcode should display all the 2D content .

Alignment issues with the 2D barcode:

          After the barcode is printed you might notice alignment issues on the label. To solve the alignment issues the following approach can be used.

          Go to Smartstyle you have used in the Smartform, select the respective paragraph format node you have assigned for the barcode. Here try

          changing the alignment and spacing values (see screen shot below) and try giving it a few trials. You will be able to align barcodes after a few




               Please make sure you have enough space for the barcode when designing the layout. I mean if you are planning to have a barcode of size

               1 CM * 1 CM then make use you have a separate window on the layout with space more than the barcode size.

                                                 —————-  THE END  —————–

Please note that the document is based on my personal experience and the online documentation i came across. So if there is any scope of improvements in this document you are most welcome to add your comments.



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks for this brilliant article!

      I have a script form which printed A4 size in HP Laser Jet printer,and I want to add data matrix in it,Could you please suggest me some method? Thanks!

      Author's profile photo umar jawid ahmed syed
      umar jawid ahmed syed
      Blog Post Author


           Thanks for the comments, Regarding DMC with Script and HP laser printer is something i have not worked on, but as long as you follow the steps mentioned in this document you will be able to figure it out eventually.

           Only differences would be adding a printcontrol command in the script and the printer language for the HP laser jet printers. So find out the printer language for HP printers, find the appropriate command for DMC (if that is supported by the printer) and create a print control for the device type. and design your script with a seperate window for the 2D barcode and add the print control command in that window.

      use the below link on how to insert print control commmand in scripts.

      Best of luck. 🙂

      After finishing your development, please do add your comments on any information you would like to share with respect to your development.

      Thanks & Regards,


      Author's profile photo Former Member
      Former Member

      Thanks Umar,

      I got advice from expert says "the critical point is “for DMC (if that is supported by the printer)”. You would need a Data Matrix barcode (DMC) font loaded or installed in the printer for the printer to support DMC.  I don’t know of any hardware or firmware that is available for HP printers that will add 2D barcodes fonts to the printer. "

      So I changed to try postscript and Adobe form.

      Author's profile photo umar jawid ahmed syed
      umar jawid ahmed syed
      Blog Post Author

      Hi Z,

           I happened to check the HP website and figured that HP laser jet does support DMC using their 'HP Barcode Printing Solution', but that is something that has to be paid for (or may be its already paid for in your case so just check) and you will get enough support for printing it through SAP if you have the product code of the printer with you by just going to the HELP section of the HP site.

           link for the same is



      Author's profile photo Former Member
      Former Member

      Thanks Umar,

      This opens another door for me. I think he means "different sizes 2D barcode is not supported in HP".I saw Data Matrix and QR in column Scalable Barcode Font marked as "N". But I'm glad to see 2D barcode is supported in HP.

      Author's profile photo Former Member
      Former Member

      Hello Umar,

      Very Useful and informative document .

      Thank you very for sharing .

      Continue the good work!!!!!

      Author's profile photo umar jawid ahmed syed
      umar jawid ahmed syed
      Blog Post Author

      Thanks for the comments Madhu.



      Author's profile photo varun yadav
      varun yadav

      very useful document for me

      thanks to share..

      Good work!!

      Author's profile photo Former Member
      Former Member

      Very Useful. Thanks for sharing this brilliant info on Barcodes..

      Author's profile photo Former Member
      Former Member

      very useful info for Barcode implementation... Thanks for sharing..

      Author's profile photo Gautam Totekar
      Gautam Totekar

      Thanks a lot. Thanks for sharing. SInce I am very new to this I have a question.  Will the barcode be reflected on the print preview or it would be reflected on the actual print on ZEBRA.
      After following all the instructions I am getting only Normal bar code on print preview. I checked the ZPL 2 commands and tried various combinations

      eg ^BXN,1,200,48,48,6,~,1^FD

      Any changes in rows and height doesnt have any impact on the barcode in print preview.

      Author's profile photo umar jawid ahmed syed
      umar jawid ahmed syed
      Blog Post Author

      Hi Gautam,

                When working with barcodes that are not supported by the printer device type or SAP, the print preview for the new barcodes won't be same as the actual print from the printer.

      Reason being, you just created a generic barcode in SAP and the actual barcode type and the length specifications are taken from the print command executed at the printer. so there is always a difference in the print preview and the actual print in such cases. Its already described in the document 🙂 .

      Hope you got your answer...



      Author's profile photo Simone Milesi
      Simone Milesi

      And 3 years after this blog, thanks again for it!

      i had the same issue printing my QR Code on a Zebra and your blog helped me a lot!

      The only difference, i had to remove the 2 commands in smartforms because they cause some weird behaviour (just for your information ? ).

      But thanks again!

      Author's profile photo Former Member
      Former Member

      Great Post. Thanks for sharing.

      We are facing a strange issue, the label is getting the truncated width wise.

      We have created a label with QR code and for printing this label we are using Zebra printer 110Xi4 203 dpi. We have configured the printer in sap based on the post shared above. The label is printed correctly. But after every few hours, the settings maintained in the Zebra printer width gets refreshed and it starts to truncate the label width wise. So every now and then I have to go to zebra printer settings through its URL/IP to change the settings and then it works fine again.

      Is this something to do with SAP printer controls or setup? Has anybody faced a similar issue?


      Author's profile photo Miguel Angel Garcia
      Miguel Angel Garcia

      Thanks a lot for your post, I'm trying to add a data matrix barcode in my smartform, but I don't find the solution, my printer is a RICOH MP 402, I supposse that I have to implement othe different node in SE73 transaction, Have you ever work with RICOH printers?

      Author's profile photo Markus Wette
      Markus Wette

      1st, many thanks to the authors of this thread.

      We had the requirement to have hex data in the datamatrix barcode.

      To implement this the ZPL2-command ^FH is needed to define the escape character for hex data.

      I used the pipe-character “|” , because in our business scenario the character is not part of the text data.

      My printcontrol (SE73): ^BXN,14,200,0,0,6,~,1^FH|^FD

      Then I use the new barcode-technology in my smartform (SSF)

      \RS\, \GS\ and \EOT\ for hex 1D, 1E, 04 (sap-note 2001392 )

      In my SSF I implemented a routine to place SSF-shortcut if print is to a zebra device.

      REPLACE ALL OCCURRENCES OF ‘\GS\’   IN dmc_data WITH   ‘|1D’.
      REPLACE ALL OCCURRENCES OF ‘\RS\’   IN dmc_data WITH   ‘|1E’.
      REPLACE ALL OCCURRENCES OF ‘\EOT\’  IN dmc_data WITH   ‘|04’.

      Works fine in my test szenario and I can use new barcode technology for ZPL2 and PCL-printers.

      Any comments, ideas to improve are welcome. (better escape character than pipe)


      Update 20.09.2021:

      for Zebra-devices; zebra provided us an update of their device type. Included was the support of non-printable characters via invocation codes as described in note 2001392 (e.g. \EOT\ for hex 04).

      I hope zebra update their download site.

      Author's profile photo steve robert
      steve robert

      A very informative article this blog is all about what I am searching for glad to visit this website as I found some information created to the topic you can also visit our website for this kind of information print test page