GS-1 / EAN 128 barcode in Smartforms to be printed on all printer types; laser, zebra etc.
When trying to gather information to print GS-1 / EAN 128 barcodes on smartforms I could not find a source with all the info. Sources on the internet only contained parts of the information needed, many weren’t conclusive (SCN threads with status ‘Unanswered’ or at best ‘Assumed answered’).
It took some trial and error to get a good result. To prevent others from having to invent the wheel again I want to share my gathered knowledge in this document.
To print GS-1 EAN128 barcodes in Smartforms we need to do the following;
1) Create a system barcode font with new technology, Code128, Mode N. Mode N allows us to switch between the different subsets (A, B or C). By this we can end up with the most compact barcode. This system barcode should have the proper linear height settings so the barcodes are printed with the required height.
If a system barcode font as shown above is not available it needs to be created (SE73).
In this example the system barcode named ‘ZEAN128N’ will be created;
With the linear height settings the output height of the printed barcode is set. 765 corresponds to 32 mm.
2) The system barcode font has to be added as a character format to the Smartstyle that will be used in the Smartform.
- In this example Smartstyle ‘Z_STYLE’ is used (tcode SMARTSTYLES).
- Character format ‘GS’ is created.
- Our newly created system barcode font is used.
- Activate the style.
- Open the Smartform, in our example ‘Z_FORM’.
- Add the style to the Smartform.
3) The code of form “STREAMLINE_BARCODE” has to be pasted in the “Form Routines” tab in the “Global Definitions” section. It is a form that converts the barcode string that is passed in, into a barcode that uses the best subsets (B or C) to make the smallest possible barcode.
The code is in the attached file. I found it in a thread on SAPFANS.COM , thanks for that!
4) Call the form “STREAMLINE_BARCODE” of step 3 after the content for the barcode has been composed. The necessary switches to make the barcode recognizable as EAN128 and to make it as compact as possible are added.
( For preparing the content of the barcode: GS-1 / EAN128 content string for the barcode consist of an application indicator (AI) followed by the relevant application content, or a series of the two. So “<AI1><Content AI1>…..<AIn><Content AIn>” )
At position A the variable gv_barcode_product_details–bc has the value:
At position B the variable gv_barcode_product_details–bc has the value:
5) For displaying the barcode: A text node with the barcode field has to be added, using the character format defined in step 2 and the content prepared in step 4.
By following these steps a proper GS-1 / EAN128 barcode should be created in the smartform.
Tip 1: To check the barcode you can install a GS-1 app on your smartphone, for example the ‘iGepir’ app for IOS and android.
Tip 2: You can scan the barcode from a print preview on the screen which saves you a lot of printing during testing. To do so go to the PDF preview of the print.
Tip 3: For zebra label printer users with European languages: Only use the HELVE font for text since it is stored in the printer memory, others fonts will result in much larger print files with all the disadvantages that come with it.