INTRODUCTION
This document describes a Barcode solution implemented in ABAP to generate/print barcodes . The project is totally developed in ABAP and it can be used with any SAP solution and version.SYMPTOM
There're differents solutions for the creation and print BARCODEs . All of them have the same problem : When you create a spool from a form/smartform with Barcodes, it's not possible to convert the spool to a PDF file because the BARCODE is created at the time of printing .See Notes OSS : 430887 , 645158
SOLUTION
This solution is totally developed in ABAP . It runs for any SAP ( and O.S. ) because it's a library and function module for the barcodes creation .Output is a data table within the barcode coordinates . You can use this coordinates to create a Barcode in a form/smartform seeing the correct Barcode image when you display the form.
It's possible to generate automatically others types of file ( using CONVERT_OTF from spool to PDF ) .
Others outputs could be HTML format or Java Bitmap , always using the barcodes coordinates ( not developed yet ) .
The process can be executed on-line and batch .
ADVANTAGE | DISADVANTAGE |
It can be use with any O.S. and SAP version . | It can’t be use for a SAP-Reports . |
It can be use with any printer connected to SAP. | |
Output to form/smartform ( PDF ) , data table ( it’s possible to format to HTML , Java-Bitmap ) | |
Free solution |
BARCODE SPECS
You need a CODECS file for decode the string to Barcode coordinates . CODECS have the definition of each barcode font and his map with each ASCII char.These are the font codes implemented and tested :
FONT | SUB-SET | CHECKSUM | CODECS | TEST |
Code 128 | A | Yes | C128 | Intermec CK31/1551 |
Code 128 | B | Yes | C128 | Intermec CK31/1551 |
Code 128 | C | Yes | C128 | Intermec CK31/1551 |
Code 39 | Yes/No | C39 | Intermec CK31/1551 | |
Code 93 | Yes | C93 | Intermec CK31/1551 | |
EAN 8 | Yes | EAN13 | ||
EAN 13 | Yes | EAN13 | Intermec CK31/1551 | |
EAN 14 | Font C128 | Yes | C128 | Intermec CK31/1551 |
CODABAR | No | CODABAR | Intermec CK31/1551 | |
UPC/EAN | A | UPCEAN | ||
UPC/EAN | E | UPCEAN |
CODECS File :
Links
http://www.barcodesymbols.com/symbologies.htm
http://www.jtbarton.com/Barcodes/Code128.aspx
http://www.barcoderesource.com/code39_barcode_map.html
http://grandzebu.net/index.php?page=/informatique/codbar-en/code128.htm
http://www.barcodeman.com/info/c39_1.php3
http://community.bartdesmet.net/blogs/bart/archive/2006/09/20/4459.aspx
http://www.barcodesymbols.com/ean13.htm
IMPLEMENTATION
Implementation of the library and functions modules has been developed in ABAP language in SAP 4.6 system , but it can run in any ABAP version ( supported by SAP ) .To install is necessary to upload the code ( Z-include and Z-functions ) on SAP-system ans save file CODECS into SAP ( or local server ) .
1. Create Structure ZBARCODE_COORDS ( SE11 - Abap Dictionary - Data Type )
2. Create Include ZBARCODE_GENERATOR
3. Create Include ZBARCODE_FORMVIEWER
4. Create Function Module Z_BARCODE_CREATE
Input Parameters :
Table Parameters :
Global Data : include ZBARCODE_GENERATOR in global data (LZBARCODETOP)
Source Code of function module Z_BARCODE_CREATE :
5. CODECS file
Save the codecs file in the SAP Application Server or in your local PC . When you execute the function , you must inform the path in the input parameter.MANUAL
Function Z_BARCODE_CREATE : you can use this function to create the Barcode coordinatesParameters :
BARCODE | initial string |
FONT | type of Barcode ( referenced to the table CODECS ) |
SUBSET | subset of Barcode ( referenced to the table CODECS ) |
CHECKSUM | generate check code (flag) |
ROTATE | Rotate Barcode 90º (flag) |
X_INI | initial X position |
Y_INI | initial Y position |
W_INI | Weight of the image |
H_INI | High of the image |
CODECSPATH | CODECS file path |
PATHSERVER | type of path ( P = presentation server / A = application server / T = Table ) |
Output table : Barcode coordinates of each black bar
X1 | X coordinate |
Y1 | Y coordinate |
W1 | Weight |
H1 | High |
Display the barcode in a SAPSCRIPT Forms or Smartforms : It depends on the window type of the Form you need to use differents PERFORMs developed in the ZBARCODE_FORMVIEWER include.
SAPSCRIPT => MAIN WINDOW : use PERFORM WRITE_FORM_BARCODE_MAIN . You need to create an element in the Main Window
SAPSCRIPT => VAR WINDOW : use PERFORM WRITE_FORM_BARCODE_VAR . In that case, you can't call to write many times at the same window ( because it isn't Main window ) . It's necesary create a SAPSCRIPT form with all the black bar ( max 500 bars ).
SMARTFORM : you have the internal table with the Barcode coordinates. Looping this table you can display the black bars in a Smartform.
EXAMPLES
This report display a sapscript form using the Z_BARCODE_CREATE function module and ZBARCODE_FORMVIEWER to display the form. If you print the form , you can convert the sap-spool to the PDF file using CONVERT_OTF function module.PDF generated from SAP-SPOOL :
Source Code Z_BCTEST :
Form Z_BCTEST (SE71): Create a sapscript form Z_BCTEST with a MAIN window. Include the BARCODE element into the main window.
No comments:
Post a Comment