Search code examples
labelzebra-printerszplbi-publisheroracle-apps

How do you use loops in ZPL to print labels on Zebra Printer in Oracle Apps R12.1.3


How can I use a ZPL loop in Oracle BI publisher to print the following labels:

order number:1234 line: 1
item: ABC1   
Qty: 10    

order number:1234 line: 2
item: ABC1   
Qty: 10  

order number:1234 line: 3
item: ABC1   
Qty: 10  

Per above example 3 stickers should come/print on the Zebra Printer

Oracle Apps R12.1.3, Bi publisher 5.6.3


Solution

  • We used delimiter based eText BI publisher templates to do exactly what you are thinking of doing. I've made several of them to print labels.

    Look up documentation on making EFT (Electronic Funds Transfer) using BI Publisher eText templates. This answer requires some basic knowledge on etext templates.

    You need eText templates so you get raw text output rather than RTF or PDF. The other option is to code it in PLSQL, which would run faster, but combining the data extraction (SQL) and formatting (Into ZPL) into a PLSQL package would require migrating across instances rather than uploading the template from the front-end in your target instance.

    The documentation will show you what to do to set the level you want to repeat (loop/for-each). Hard code ZPL you want to remain static like begin/end label, print quantity, etc.. Concatenate that with the changing item details. You'll end up with something like:

    '^XA'
    '^PQ1,0,0,N^CI0^PW812^MMT^LL406'
    '^FT40,1300^A0N,24,24^FH^FN97^FD'||ITEM_NUMBER||'^FS'
    '^XZ'
    
    • Each of those would be its one <NEW RECORD>
    • Your <MAXIMUM LENGTH> would be 400 or something large-ish
    • Your <FORMAT> would be Alpha

    Unfortunately since the eText templates are RTF files, and formatting is very important, I can't just put the exact code/formatting/syntax in here. But this can give you a good example:

    etext ZPL Example