How can I print a SSCC with GS1-128 (EAN-128) barcode?

I need to print a Serial shipping container code (SSCC) in my report GS1-128 barcode. The former correct name was EAN-128.

I have a company code “37610425” and a list of increment numbers.

The JBarcodeBean supports only Code-128.

The code GS1-128 is a Code-128 but with a specific content structure. See the Wikipedia for more details.

To create the structured data for a SSCC you can use the follow user defined function in your report:

// company: must be 8 charcters with your company number
// number: the container number
Function ( StringVar company, NumberVar number )
    if( length( company ) <> 8 ) Then (
    debug( "Error: Company name must have 8 characters: " + company );
    "";
    ) Else (
    Local StringVar digits := company + ToText( number, "000000000" );
        Local NumberVar l := length(digits);
        Local NumberVar i := l;
    Local NumberVar s := 0;
    while i > 0 do (
        Local NumberVar v := Val( mid(digits, i, 1 ) );
        Local NumberVar m := (l - i) mod 2;
        If ( m = 0 ) Then
    	    s := s + 3 * v
        Else
    	    s := s + v;
        i := i - 1;
    );
    s := 10 - s mod 10;
    Chr(128) + "00" + digits + ToText( s, "0" );
)

This function can you use in a formula like:

GS1SSCC("37610425", 2123456)

This formula use you in a the “code” formula of the JBaracodeBean. The codeType set you to “CODE 128”.

Since version 15.1 you can also use the ZxingBarCodes instead the JBarcodeBean. Then you must replace the “Chr(128)” with “Chr(241)” in the user defined function.

© Copyright 1996 - 2018, i-net software; All Rights Reserved.