Checksum algorithm for EAN-8 bar code type in AX
Haven’t you ever thought about checksum algorithm for EAN-8 bar code type in AX?
An EAN-8 is a barcode and is derived from the longer European Article Number (EAN-13) code. It was introduced for use on small packages where an EAN-13 barcode would be too large; for example on cigarettes, pencils (though it is rarely used for pencils), and chewing gum packets.
EAN-8 barcodes begin with a 2- or 3-digit GS1 prefix (which is assigned to each national GS1 authority – company code) 5- or 4-digit item reference element depending on the length of the GS1 prefix), and a checksum digit.
Here is how an EAN-8 bar code looks like

Let’s setup all necessary preconditions in AX:
Bar code setup:
Retail and commerce > Inventory management > Bar codes and labels > Barcode setup
or
Organization administration > Setup > Bar codes
Having filled Bar code type as EAN8, you can create Bar code for the item

Navigate to Product information management > Products > Released products
Switch to Manage inventory tab and click Bar codes button
Specify newly created bar code setup, insert Bar code and save the record.
The system will check that you’ve inserted incorrect bar code displaying error message

Suggest working out what the calculation is.
Check digit calculated according to Modulo 10
Go ahead and calculate digit for our case
Our barcode is 23456789
- 2+4+6+8=20
- 20*3=60
- 3+5+7=15
- 60+15=75
- 75 + X = 80 (next highest multiple of 10), therefore X = 5 (checksum)
So the system expecting check digit 5
In other words, calculating the Checksum looks like:
- Add the values of the digits in positions 1, 3, 5, 7
- Multiply this result by 3.
- Add the values of the digits in positions 2, 4, 6.
- Sum the results of steps 2 and 3.
- The check character is the smallest number which, when added to the result in step 4, produces a multiple of 10.
Having changed last digit to 5, you will manage to save the record

This was originally posted here.

Like
Report
*This post is locked for comments