Skip to Content
Technical Articles
Author's profile photo stephen xue

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.

Assigned Tags

      5 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Michelle Crapo
      Michelle Crapo

      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?

      Author's profile photo stephen xue
      stephen xue
      Blog Post Author

      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?

      Author's profile photo Michelle Crapo
      Michelle Crapo

      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.)

      Author's profile photo ratnesh chaurasia
      ratnesh chaurasia

      Using Adobe Interactive Forms customers are able to generate reports in form of a label but many a times fonts and few graphics don't get printed as seen in preview or pdf file when output is saved as pdf. Zebra Printers support pdf direct print mode and can receive and print pdf without needing any middleware. While using Adobe Interactive forms, how can we configure output to go as pdf file to Zebra device configured.

      Author's profile photo stephen xue
      stephen xue
      Blog Post Author

      Hi Ratnesh,

      my client currently doesn't use adobe form so far.

      BTW, do you mean to convert adove form into a PDF file (soft copy)? if that is the case, you can try device type PDF1.