2d Barcode Prints

11
8/19/2019 2d Barcode Prints http://slidepdf.com/reader/full/2d-barcode-prints 1/11  Introduction: In this document we will work on printing a Data Matrix barcode (DMC) which is a 2D barcode not supported by SAP. A 2D (two-dimensional) barcode is a graphical image that stores information both horizontally -- as one-dimensional  bar codes do -- and vertically. As a result of that construction, 2D codes can store up to 7,089 characters and possibly more. Below are some of the types of 2D barcodes  Requirement: Print Data Matrix barcode (2D barcode) on zebra printers using Smartform. * Similar approach can be followed for printing other 2D barcodes and the generic barcodes with specific height and width. Issue: SAP by default only supports PDF417 as 2D barcode and does not support Data Matrix and other 2D barcodes Solution: Printing other 2D barcodes which are not supported by SAP is possible by following the below steps  Printer should support the required barcode: We can check this online based on the printer model and make. Most probably you will find this information on the manufacturer’s website.  Choose an appropriate device type for the printer: Selection of device type is based on the printer you are using. In this example we are using ZEBRA printer so the device type selction will be based on Zebra printer. This topic is dealt in more detail in the other document named Working with Zebra Printers using Smartforms in SAP please refer to the same for additional documentation on selecting the device type for Zebra printers. For Zebra printers we have the following device types LZEB* (* => 2/3/4) series or YZB# (# => 200/300/400) series based on the DPI resolution of the printer. 

Transcript of 2d Barcode Prints

Page 1: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 1/11

 

Introduction: 

In this document we will work on printing a Data Matrix barcode (DMC) which is a 2D barcode not

supported by SAP. 

A 2D (two-dimensional) barcode is a graphical image that stores information both horizontally -- as

one-dimensional  bar codes do -- and vertically. As a result of that construction, 2D codes can store

up to 7,089 characters and possibly more. 

Below are some of the types of 2D barcodes 

Requirement: 

Print Data Matrix barcode (2D barcode) on zebra printers using Smartform. 

* Similar approach can be followed for printing other 2D barcodes and the generic barcodes with

specific height and width. 

Issue: 

SAP by default only supports PDF417 as 2D barcode and does not support Data Matrix and other 2D

barcodes 

Solution: 

Printing other 2D barcodes which are not supported by SAP is possible by following the below steps 

  Printer should support the required barcode: We can check this online based on the printer model

and make. Most probably you will find this information on the manufacturer’s website. 

 

Choose an appropriate device type for the printer: Selection of device type is based on the printer

you are using. In this example we are using ZEBRA printer so the device type selction will be based

on Zebra printer. This topic is dealt in more detail in the other document named ‘Working with

Zebra Printers using Smartforms in SAP’ please refer to the same for additional documentation

on selecting the device type for Zebra printers. For Zebra printers we have the following device

types LZEB* (* => 2/3/4) series or YZB# (# => 200/300/400) series based on the DPI resolution of the

printer. 

Page 2: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 2/11

  For the demonstration as an example we will use LZEB2 device type from here on in this

document. 

  Create a system barcode of type UNDEF in SAP: For creating a system barcode go to transaction

SE73. 

This will take you to the SAP script Font Maintenance: Initial screen 

Select System barcodes check box and click the change button. This will display a list of all the

Barcodes on the SAP system. 

Click the Create button (Paper icon) at the top of the screen 

The Choose Bar Code Technology select box will now be displayed. 

The barcode we are adding is a new barcode symbology which is not supported by SAP, and the new

barcode technology allows only specific types of barcodes symbologies to be created therefore we

are going to use Old technology to create our new barcode as an undefined symbology. 

So Click on Old. 

The Create/Change System Bar Code settings screen will be displayed. For barcode type enter

‘UNDEF’ (barcode not defined) as the data matrix barcode type is not defined in SAP. Also specify the

height and width of the barcode. 

Page 3: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 3/11

 

Then save the changes by clicking on the Ok button. Now the system barcode ZDMC is created. 

 

Create a printer barcode for the newly created system barcode with appropriate print control: 

For creating a system barcode go to transaction SE73. This will take you to the SAP script FontMaintenance: Initial screen 

Select printer barcodes check box and click the change button. This will display a list of device Types

available in SAP system. 

In this case I am using device type LZEB2 so I will create a printer barcode for this device type. It is

advisable to copy this device type to a new device type and then make changes to the new Z device

Page 4: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 4/11

type and use it for printing but for demonstration I am using the same device type. Double click on

the device type to list the barcodes supported by this device type. 

Notice the Prefix and Suffix value ranges used for the barcodes. Here in this case the highest number

used for prefix is SBP20 and is different for each barcode however the suffix is same for all the

barcodes. These prefix and suffix are the print controls of the barcodes supported by the printer. 

Now select the create button on the top of the screen to add a new printer barcode. This will take

you to the barcode selection screen. 

Select the system barcode you created earlier and enter the other values as shown in the screenshot

above. For prefix we are entering SBP21 because all the numbers from 1 -20 (SBP01 to SBP20) are

already used so we are using the next available number SBP21 and the suffix number stays the same.

We can use any number from 21-99 for prefix. 

Now the barcode is created for the device type (see screen shot below) 

Page 5: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 5/11

 

But the print control SBP21 is empty. For the barcode to work properly we have to add commands in

the print control in ZPL-II language (printer language). Please find the online document named

'ZPL2 command book ' . The site link for the same is 

http://www.zebra.com/id/zebra/na/en/documentlibrary/manuals/en/zpl_ii_programming2.File.tmp/45541L-002_RA.pdf  

It is advised to have the document before we proceed further. This command book has all the

commands for printing different types of barcodes on a printer ( only if the printer supports it )using

the ZPL2 command Language. 

Here we are adding the Data matrix barcode, and the printer command format for printing the data

matrix is: ^BXo,h,s,c,r,f,g 

Command Parameters: 

O  – Orientation 

H  – Height 

S  – Quality level 

C  – Columns to encode 

R  – Rows to encode 

F  – Format ID 

G  – Escape sequence control character 

Refer to the attached command book for accepted and default values for the above parameters and

how to use the command. 

Below is an example of the post script language commands used for printing a DMC barcode on the

printer. 

Page 6: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 6/11

 

The printer command mainly needs to have 3 types of information 

1. 

Command to indicate the type of barcode to be printed ( Marked by ^BX in the command above) 

2.  Command to indicator the start of data ( Marked by ^FD) 

3. 

Command to indicator the end of data (Marked by ^FS) 

4. 

When working with Smartforms the prefix print control in the printer barcodes screen should have

both the commands for the type of barcode and the command for the start of data whereas the

suffix will only have the command to mark the end of data. 

Taking the above points into consideration we will have ^BXN,2,200,20,20,6,~,1^FD command

in prefix and ^FS in suffix.  As the suffix is used to mark the end of data it is same for all the

barcodes and hence maintained as default. 

Meanings of the command Parameters for prefix ^BXN,2,200,20,20,6,~,1^FD are: 

^BX The Data Matrix command 

N The orientation is normal 

2 Dimensional height in dots of the individual symbol elements 

200 Quality ECC level (ECC 200) 

20 Columns to encode 

20 Rows to encode 

6 Data to be used (6 means full 256 ISO 8-bit data is used) ~ Escape sequence for control characters 

Page 7: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 7/11

  1 Square aspect ratio, if you required rectangle this will be 2 

^FD This is to mark the start of the field data to be encoded in the barcode 

Add the following command in the print control prefix: ^BXN,2,200,20,20,6,~,1^FD 

Go to SE73 -> Select printer barcodes -> Change ->Select device type (in this case LZEB2) ->

double click to display the list of barcodes supported 

by the device type. 

Select the new print control SBP21 (barcode prefix) and click on Maintain Print

control button. Following popup will be displayed. 

Enter the command in the control characters sequence field and make sure the Hexadecimal

switch is turned OFF. Then press enter. -The print control is saved. 

The barcode suffix SBS00, which is default for all the barcodes holds the end of data

command (see below) 

Page 8: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 8/11

  The configuration of the printer barcode is complete. Now we can use this barcode to print

the Data Matrix barcode (2D barcode) from SAP. 

Note: 

There can be various combinations to the prefix command. If the barcode is not printed

then you have to try changing the values for the height, 

rows and columns variables in the command. The prefix combination that worked for me

is:^BXN,3,200,,,6,~,1^FD 

 

Use the barcode in the Smartform using a style: 

Please refer to online documentation for adding a barcode to a style in Smartform. 

After you have added the barcodes to one of the character formats of the style which is being

used in the Smartform, we just have to use the 

newly created barcode type to display the 2D content as Data Matrix Barcode. 

See below screenshot for an example. 

As the example depicts, use a separate text node for the 2D barcode , keep all the 2D content in

a variable or write it all down in the text node. 

Select the whole text and select the character format for the DMC barcode. 

At this point if you try to print the barcode it is expected to see the barcode on the printout,

but you might not see the barcode printed on the 

printer, the reason as i understood is that based on the ZPL2 command the data should be

marked with the start of data command and End of data 

command along with the type of barcode we are trying to print. so the commands should be

inserted before and after the text node that holds 

the 2D data content. This will give the printer a command saying that the data between this is

to be printed as the barcode symbology specified in 

the command, in our case Data Matrix. 

 Note : Preview will not show the barcode because literally this barcode is not in SAP systemand will only be printed on the printer. So anything 

Page 9: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 9/11

  concerning the barcode has to be tested on the actual printer not the preview because both

the preview and the actual print will be a lot 

different. 

 

Create a command node before and after the text node that holds the 2D barcode content: 

See below screen shots for an example on how to create a command node. 

Then enter the prefix print control we created in the printer control input field (see below). 

Create one more command node under the 2d content text node and enter the enter the suffix

print control in the printer control input 

field (see below) 

Page 10: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 10/11

 

Now test the print on the Zebra printer, the barcode should be printed on the zebra printer asshown in the screen shot below. Now take the 

printout and scan the barcode with any of the android apps or any barcode reader that support

DMC barcode. Please note that the printout taken 

on your local printer from a scanned document wont be readable, so it is advised to test the

barcode scanning from the actual printout or from the 

Scanned document on your computer. 

After scanning, the barcode should display all the 2D content . 

Alignment issues with the 2D barcode: After the barcode is printed you might notice alignment issues on the label. To solve the

alignment issues the following approach can be used. 

Go to Smartstyle you have used in the Smartform, select the respective paragraph format node

you have assigned for the barcode. Here try 

changing the alignment and spacing values (see screen shot below) and try giving it a few trials.

You will be able to align barcodes after a few combinations. 

Page 11: 2d Barcode Prints

8/19/2019 2d Barcode Prints

http://slidepdf.com/reader/full/2d-barcode-prints 11/11

 

Note: 

Please make sure you have enough space for the barcode when designing the layout. I meanif you are planning to have a barcode of size 

1 CM * 1 CM then make use you have a separate window on the layout with space more

than the barcode size. 

---------------- THE END ----------------- 

Please note that the document is based on my personal experience and the online documentation i

came across. So if there is any scope of improvements in this document you are most welcome to

add your comments.