web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Custom label printing - ZPL to print a label per return order line

(5) ShareShare
ReportReport
Posted on by 50
Hi,
 
I am trying to print a custom label from the return order form, and want to print a label for each return order line. For a 3 line order I should get 3 labels, each with different line item information.
 
 
I have landed on {{Row Table=SalesLine_1 RowsPerLabel=1 - I am getting 3 labels sent to the virtual printer (Dynamics info box confirms), I see 3 labels on my virtual printer, but labels 1 and 2 error, and label 3 has the correct information for the 3rd order line.
 
If I use line: {{Row Table=SalesTable_1 RowsPerLabelFirst=1 RowsPerLabel=1 I get the 1st label for order line 1, and no other labels for line 2 and 3.
 
I have tried to play around with {{Header and {{HeaderFirst, but not had any luck.
 
 
Is my {{Row Table= incorrect? Do I need any other identifiers or variables on the label to identify each line? 
If I use {{Row, do I also need to include {{Header and {{Footer?
 
Thanks in advance for any guidance. 
 
I have the same question (2)
  • Suggested answer
    Ben Ashe Profile Picture
    50 on at
    Custom label printing - ZPL to print a label per return order line
    Update: I've managed to resolve this one.
    I'm not actually 100% sure how - I think I had some { } in the wrong place. A bit of trial and error led me to multiple label prints for multiple order lines. 
  • Claes Laine Profile Picture
    2 on at
    Custom label printing - ZPL to print a label per return order line
    Hi
     
    Great to hear that you have solved this issue, I am having the same issue.
    Could you explain in more detail how the label code was written to be able to print the order lines related to the header?
    The issue I have is that I would like to print from All shipments, but I would like to print 1 label per shipment line.
     
    Regards
    Claes Laine
  • BA-11121342-0 Profile Picture
    4 on at
    Custom label printing - ZPL to print a label per return order line
    Hi Claes, 
     
    I used something like this, below. It's certainly not perfect ZPL code, in fact, I'm sure, far from it, but it did achieve the results we wanted (a printed label per line on the return sales order).
    Note: I removed some customer elements of the code, but you can see the structure of LabelStart, Header etc.
     
    Based on your challenge for shipments, I expect you would need to change the bold line in the code from SalesLine to the shipment line table, and add the data to the label layout in document routing. 
     
    Good luck :)
    Ben
     
     
    {{LabelStart
    ^FX ... ZPL commands to start the label ...
    ^XA
    ~TA000
    ~JSN
    ^LT0
    ^MNW
    ^MTT
    ^PON
    ^PMN
    ^LH0,0
    ^JMA
    ^PR6,6
    ~SD15
    ^JUS
    ^LRN
    ^CI27
    ^PA0,1,1,0
    ^XZ
    ^XA
    ^MMT
    ^PW800
    ^LL900
    ^LS0
    }}
     
    {{Header
    ^FX ... Top section with....
    ^CF0,60
    ^FO220,30^GFA,^FS
    ^CF0,30
    ^FO220,115^FD^FS
    ^FO220,155^FD^FS
    ^FO220,195^FD^FS
    ^FO50,120^GB700,3,3^FS
    ^FX ... Second section with Customer Name, RMA Number and RMA Header Return Reason Code ...
    ^CFA,40
    ^FO50,200^FD$SalesTable_1.SalesName$^FS
    ^FO50,250^FD$SalesTable_1.ReturnItemNum$^FS
    ^FO50,350^FD$SalesTable_1.ReturnReasonCodeId$^FS
    ^FO50,400^FDExpected Returned Qty $SalesLine_1.ExpectedRetQty$^FS
    }}
     
    {{Row Table=SalesLine_1 RowsPerLabel=1
    ^FX... ZPL commands to format the row
    ^FO50,500^FD$SalesLine_1.ItemId$^FS
    ^FO50,550^FD$EcoResProductTranslation_1.Name$^FS

    ^FO50,700^FDROUTE NUMBER: ^FS
    ^FO50,750^FDDROP SEQUENCE:^FS
    ^CFA,15
    ^FO50,800^GB700,3,3^FS
    }}
     
    {{Footer
    ^FX Third section with bar code (currently BE format, EAN 13 barcode).
    ^BY3,2,200
    ^FO270,950,2^BE^FD$SalesTable_1.ReturnItemNum$^FS
    }}
     
    {{LabelEnd
    ^FX ... ZPL commands to end the label ...
    ^XZ
    }}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 876

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 264 Super User 2025 Season 2

#3
Sagar Suman Profile Picture

Sagar Suman 210 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans