20

Print barcode on Zebra Printer Directly From ABAP report without Form

 3 years ago
source link: https://blogs.sap.com/2021/07/01/print-barcode-on-zebra-printer-directly-from-abap-report-without-form/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Technical Articles
Posted on July 1, 2021 1 minute read

Print barcode on Zebra Printer Directly From ABAP report without Form

3 Likes 59 Views 1 Comment

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

01.png

click the create button as below

02.png

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.

03-1.png

configure the access method

04.png

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK