Product Labels and Barcodes in SAP Business One
I've covered a lot about Barcodes in the last two newsletters. We've looked at the types of barcodes, how to produce EAN-13 and Code 39 natively in Sap B1, and how to use Code-128 in Crystal reports using some external code. I've intentionally left for the last one of the more complex issues with Barcodes: using them on final products. Product labels are complex. Many products will require additional labeling for safety, health, or use. But strictly from a bar code perspective, you'll have a combination of UPC, lot number, serial number, date of manufacture, sell-by date, or expiration date. Depending on the product.
Product labels provide complexity: you might print on preprinted labels or create on-site labels. For example, consider a food product: Huli Pizza Bites, which I introduced in a previous newsletter on Batch numbers. There would be ingredients and nutrition labels involved here, but let's assume that's a separate label or preprinted on the box. The label could be a preprinted label like this:
An inkjet or thermal transfer printer would print barcodes in the white rectangle. Alternatively, we could use a monochrome label and print everything.
With one exception, The other two articles have explained how to print barcodes that would have this information. I want to show you how and where to get the barcode information this time.
Getting the Data
We will need the information on their GTIN, expiration or sell-by date, and batch number for the pizza bites. There are several options for getting this data. The simplest is manual entry through a parameter, which adds possibilities for human error. The second is to store data in SAP in user-defined fields in Production Orders (OWOR) and Item Master Data (OITM). A variation of this creates values using user-defined values in those UDFs. The last option is to use the Batch number system of SAP. Let's look at how we could use these for our labels.
GTINS and UPCs
The Global Trade Identification Number or GTIN identifies the product. GTINs are a superset of UPC and EAN codes. The difference is that UPCs are 12-digit GTINS meant for the U.S. and Canadian markets, while EAN is a 13-digit GTIN for the rest of the world. Both are registered through GS1. A 12-digit UPC can become an EAN by prefixing it with a 0.
In the OITM table, you'll find a column called Codebars. OITM.CodeBars is where you store your GTIN. When you have individual products, you can add them directly to the Item Master Data. An easy way to populate your GTINS is to use DTW or Import from Excel to import them from a spreadsheet.
There's one wrinkle to this: different units of measure may have different GTINS. A six-pack may have a different GTIN than an individual package. That's one use for the bar code module in SAP. You can add multiple items to a GTIN number. For example, here's the printer paper from OEC computers showing different Units of measure having corresponding GTINS:
If you are using the unit of measure feature in the item master, similar to the paper in ODBCDemo, this can be useful.
If possible, I like to have different Item master data for variation in the Unit of Measure. An individual unit is an item, and a Six-pack of that item is another. That may not be your inventory configuration, unfortunately.
Batch or Lot Numbers
There are two ways you might use batch numbers: the first is through A UDF. If your production system has a 1 to 1 relationship between Production orders and Batch or lot numbers, this is a simple way to handle lot numbers. You'll include this in your query for crystal reports this UDF.
Batch numbers are odd, as every organization uses a different type. An alternative is to assign a batch number based on the closing or release date of the Production order. A typical batch is a Julian date. You can do a query like this.
SELECT datepart(year, t0.ReleaseDate) * 1000 + datepart(dy, @t0.releaseDate) AS Julian_Date FROM OWOR T0
You can be a UDF and put this into a user-defined value for more automatic generation. Some companies add production line or facility codes to the batch number.
However, if you don't have the luxury of a 1 to 1 relationship and have multiple batch numbers on a single production order, you'll need to use the Batch number system in SAP B1. I describe how to use it in SAP Business One Production and Logistics and Part One and Part Two of a series I did in the Bizoneness newsletter. You can read all the workflow to access batch numbers, though you will use and apply a type of 60 for the Goods Issue if you print labels before a delivery document. If you print labels after a delivery document, 15 for the delivery document will work.
Expiration or Sell by dates
An expiration, use, or sell by date indicates to a consumer or retailer that the product no longer meets the quality criterion. These are different.
Sell-by dates are the last date a retailer should sell the product.
Best Before or Best By are recommendations to the final customer on when to stop using or consuming the product.
Finally, there are expiration dates, the last date anyone should use or consume the product.
Recommended by LinkedIn
While you could have all three, one of these generally will be found prominently on the label, though the barcode may use a second one. The batch number function in Sap B1 can store these associated with a batch number. Like expiration date, these might be added to a UDF in a Production order or Manually entered through a parameter.
Adding to the Label
Once you have the data points used on the label, you'll add them. But there are a few more decisions you'll have to make:
The UPC - Code 128 or EAN?
Another decision is to use EAN-13 or Code 128 barcodes for the GTIN. The answer depends on who is the final customer. For Business-to-Business, go with Code 128, the inventory management standard. If this product is sold to retail operations, most product labels use the EAN-13 label.
However, you might use both but on different packaging. For example, I might have a Code 128 label for a case of pizza bites that ships to distribution centers or stores. Inside that box are using labeled with the EAN-13.
Using Code 128, you prefix an Application Identifier(AI) of (01) to the GTIN.
Expiration and Batch Number AIs
The usefulness of the GS1-128 variant of Code 128 is the FNC1 digit, a character that separates AIs and indicates the following few characters are an AI. You can thus join two or more AIs into a single barcode. Often we do this with lot numbers and expiration dates.
Dates and batch numbers have their AIs, all beginning with 1.
Batch numbers can be up to 20 alphanumeric characters long. Dates are all in the form of two-digit years, months, and days.
You can make multiple barcodes, each starting with the UI.
However, AI's give you the luxury of combining AI into one barcode separated by FNC1. The FNC1 is optional in fixed-length AI, such as dates, but required to terminate and start a new AI in Batch and lot numbers. For example, if ① represents FNC1
1023135①17230715
Would be the Lot number followed by the Expiration date. The human readable would be:
(10)23135(17)230715
Some barcode readers will have problems with this coding, so a typical order is to keep the variable-length value last, so that would be Ai's 17, then 10.
17230715①1023135
Giving a final barcode of
There's Always One More Bug
I was going to demonstrate next how this all goes together. Unfortunately, that barcode doesn't encode correctly in Crystal Reports. I have to fix a bug related to FNC1 first; I learned about it when I went to make the demo for this post. I originally made the code I introduced last time for a single AI, not multiple ones. It does not work well for multiple AIs, as the FNC1 joining AIs adds the wrong character and the function adds some extraneous data that destroys the check digit.
Therefore, We'll have one more part to this where I'll demonstrate putting a preprinted product label together in crystal reports with multiple AI barcodes.
I caution against ordering many bytes, because early this year restarted a journey into mobile Mac Air📱🤞