Skip to Content
Technical Articles

Print barcode on Zebra Printer Directly From ABAP report without Form

Introduction

The normal way to print a barcode or a string to a zebra printer is via smartform or interactive form. However there are some cases the request doesn’t come from any forms, but to print the ZPL directly in the zebra printer. Here are the steps for a sample ‘Hello World’  building from scratch.

1.Configure the printer in the SAP system.

tcode: SPAD

Enter a new name for the printer and click display

click the create button as below

 

since the output device is used to print ZPL directly, we will not select the device type for converting forms into ZPL. Please manually select LB_ZEB. My printer is ZM400. Assume this type is univeral for most of the Zebra Printers.

 

configure the access method

 

record the short name ‘ZB01’.

2. ABAP program prining ‘Hello World’ to the Zebra Printer

REPORT ytest_print3.

DATA: output_device(4) TYPE c.
output_device = 'ZB01'.  " The device short name

NEW-PAGE PRINT ON
   DESTINATION output_device
        COPIES 1
     LIST NAME space
  LIST DATASET space
   IMMEDIATELY 'X'
       KEEP IN SPOOL 'X'
    LINE-COUNT 60
     LINE-SIZE 100
        LAYOUT 'G_RAW'
      NEW LIST IDENTIFICATION 'X'
SAP COVER PAGE space
            NO DIALOG
            NO-TITLE
            NO-HEADING.

"zpl
WRITE: / '^XA ^PW800'.
WRITE: / '^FO50,60^A0,40^FDHello World!!^fs'.
WRITE: / '^fo60,120^by3^bcn,60,,,,a^fd1234567890ABC^fs'.
WRITE: / '^FO25,25^GB480,200,2^FS'.
WRITE: / '^XZ'.

NEW-PAGE PRINT OFF.

 

Conclusion

By this means, you will get ‘Hello World’ to be printed on the sticker via the Zebra Printer. Wish you find it useful.

3 Comments
You must be Logged on to comment or reply to a post.
  • It's an interesting way of doing things.  I'm not sure I'd use it.   Simply because I like the bar code language in a different place.  For example Smartforms.

    Do you see an advantage to doing things this way?

    • thanks for reading.

      In fact, there are some cases that the content to be printed is not from a Smartform, but from 3rd party service or middleware. There is no smartform at all in the whole process. Think about you get a ZPL stream of a barcode by calling an external http service and you are supposed to print it on a Zebra, how you are going to start your work?

      • Great point!   How would I start my work? - with variables.  But yes, now I see how this would be more effective.

        When I think about what I've used bar codes with - I've had an easier job.  Even if they were from a 3rd party software, usually they were add-ons.   SAPConsole comes to mind as one of the things that I used.  (I wonder if that one is still used.)