Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Robert_Russell
Contributor

Preamble....

A while back I lost access to my user account for SCN; this was due to a change of job which meant losing access to the ‘S’ user account I had registered with. Also one aspect of the new platform is that you can’t transfer/merge user accounts at the moment (and it will be “months” before this is possible). One of the first actions recommended for the new platform was to move your blogs to spaces, which is not possible for me. During the move to the new platform there was some damage to my blogs with a loss of images/formats and they are not in a state that I like and I can't update them.

So when the Barcode Writer in Pure Postscript (BWIPP) was updated a short time ago to include Kanji encoding, this was an obvious step for myself to update the Japanese SAP device type I had with the latest BWIPP version and post an update blog here on the new SCN. As my journey into the world of QRcodes/Barcodes began in Japan and I already had a version for a long time based on the Japanese SAP postscript device type, the actual QRcode Kanji encoding appealed to me for an update even though I have left Japan a long time ago. I also cover other aspects of using the BWIPP in this blog, including an ASCII85 (ASCII85 wikipedia entry) version and another section covering SAP server side setup.

When and if I get access to my original blogs I will remove this first section of the blog.

Most of the technical details I have used can still be found in my original blogs here.

i) http://scn.sap.com/people/robert.russell/blog/2010/10/25/barcodes-in-sap-with-the-barcode-writer-in-...

ii) http://scn.sap.com/people/robert.russell/blog/2011/01/31/more-barcodes-with-barcode-writer-in-pure-p...

BWIPP in SAP update

1) Updated QRcode device type

In my original development of the SAP barcode device types based on the BWIPP it was suggested to use the BWIPP ASCII85 encoded versions. The ASCII85 BWIPP versions can be found here.


I do like the ASCII85 encodingmethod as it reduces the amount of code and therefore the size of the SAP device type. The number of "action pages" in the device type is reduced from 5 to 2 for the QRcode version.


The new device type also contains two extra print controls to cover some extra formatting options for smartforms. The first SDN blog covers printing to text files first to determine the correct print controls, the comments section to that blog also cover these new print controls.


Download link to the new QR code device type is here


The zip file contains file ZBWPQR2.PRI which is the ZBWPQR2 device type.

Follow the original QRcode blog but use the ZBWPQR2 device type


The main benefits are

*Reducing the number of SAP Action pages required for the device type.

*Reducing the size of the device type

*The extra print controls covering Smart Form formatting.

New device type print controls

In most "normal" formatting of smartforms then new print controls are not required, however if no barcode is displayed then the format of the postscript generated from the smarform needs to be checked as described below.

There is a section in my first SDN blog about "Identify the Text for the Barcode" so if I quote the relevant section below.

"Standard formatted text can appear with the "s" command however sometimes especially if small text formatting is used other postscript procedures such as "w1" and "w2" appear. So any new form or output that requires a barcode should be output to a flat file. This is to check the file for the postscript formatting and commands used by SAP. This can be useful to note where to insert postscript commands via print controls (also for any trouble shooting). A tip for smartforms and sapscript is to search for lines with "<~" and "~>" as this signals ASCII85 encoded text. "

As the smartform will be converted to postscript then the way the smartforms text format is converted is vital to allow the barcode to be printed.

a) So lets start by creating a Windows frontend printer that prints purely text.
This will be used to create a text file of the SAP generated postscript.

Follow this note but use the QRcode/barcode device type
Note 576973 - Creating a file printer on a Windows PC

b) send the smartform to the new frontend printer.
You will be prompted for a file location so enter c:\smart.ps for example (the full path must be entered).

For example in the following screen shot I have used various formats in a smartform and I sent the output to the file printer on my desktop.

c) open smart.ps and search for "/s {bct exch ctxt" which is the start of print control ZBW01. (Note I have added the "= testing .... " text myself for this blog to match the above smartform screenshot.)


In the above smartform output shown in the red box, there is some formatting to do with the width/size of the text so the normal postscript s command is not used and therefore the qrcode would not be generated correctly.

*NOTE, in the above example the formats in the postscript use w1 and w2 as an example, the exact formatting may be different in your smartform.

The postscript commands w1 and w2 are used instead of the S command in the smartform. Therefore to keep the formatting in the smartform we can use the two new print controls.

The TWO new print CONTROLS are.
ZBW90 = /w1 {bct} def /w2 {ctxt /bct exch def} def \n
ZBW91 = /w1 {SW 0 8#040} def /w2 {widthshow} def \n


d) Change the smartform to include the new print controls


..TEXT - empty / or blank lines to make room for the barcode
..PRINT CONTROL ZBW90
..TEXT FOR BARCODE
..PRINT CONTROL ZBW02
..PRINT CONTROL ZBW91


Basically the ZBW90 changes the W1 and W2 commands to allow the concatenation of the text.
ZBW02 is the same command to generate the QR code.
ZBW91 resets the W1 and W2 to SAP standard postscript.


e) Print the smartform to the original QRcode(barcode) printer with the new print controls and the QRcode should now appear in the output.


The following extract is from the Barcode Writer in Pure Postscript page detailing all the supported barcodes. Using the same method any of these could be incorporated into an SAP device type. If you see any you would want to use in SAP then you could follow the original SDN blog to create your own.


The BWIPP supports an impressive list of barcodes, as listed here from the BWIPP site.


The project supports all major barcode symbologies including:

EAN-13(EAN, UCC-13, JAN, JAN-13, EAN-13+2, EAN-13+5, EAN-99), EAN-8(UCC-8, JAN-8, EAN-8+2, EAN-8+5, EAN-Velocity), UPC-A(UPC, UCC-12, UPC-A+2, UPC-A+5), UPC-E(UPC-E0, UPC-E1, UPC-E+2, UPC-E+5), ISBN(ISBN-13, ISBN-10, Bookland EAN-13), ISMN,ISSN, EAN-5 & EAN-2(EAN/UPC add-ons), GS1 DataBar Omnidirectional(RSS-14), GS1 DataBar Stacked(RSS-14 Stacked), GS1 DataBar Stacked Omnidirectional(RSS-14 Stacked Omnidirectional), GS1 DataBar Truncated(RSS-14 Stacked), GS1 DataBar Limited(RSS Limited),GS1 DataBar Expanded(RSS Expanded), GS1 DataBar Expanded Stacked(RSS Expanded Stacked), GS1-128(UCC/EAN-128, EAN-128, UCC-128), SSCC-18(EAN-18, NVE), EAN-14(UCC-14), GS1 Composite(EAN/UPC, GS1 DataBar and GS1-128), ITF-14(UPC SCS), QR Code(Quick Response Code, Micro QR Code), Aztec Code (Compact Aztec Code, Aztec Runes), Data Matrix(Data Matrix ECC 200), GS1 DataMatrix, PDF417 (Truncated PDF417), MicroPDF417, MaxiCode (UPS Code, Code 6), Codablock F, Code 16K(USS-16K), Code 49(USS-49), Code One (Code 1, Code 1S), USPS POSTNET, USPS PLANET, USPS Intelligent Mail(USPS OneCode), USPS FIM, Royal Mail(RM4SCC, CBC), Royal TNT Post(KIX), Japan Post, Australia Post, Deutsche Post Identcode(DHL Identcode), Deutsche Post Leitcode(DHL Leitcode), Pharmacode (Pharmaceutical Binary Code), Two-track Pharmacode (Two-track Pharmaceutical Binary Code), Code 32(Italian Pharmacode), Pharmazentralnummer(PZN, PZN-8, PZN-7), Code 39(Code 3 of 9, LOGMARS, Alpha39, USD-3, USD-2, USS-39), Code 39 Extended (Code 39 Full ASCII), Code 93(USD-7, USS-93), Code 93 Extended (Code 93 Full ASCII), Code 128(Code 128A, Code 128B, Code 128C, USD-6, USS-128), Code 2 of 5(Code 25, Industrial 2 of 5, IATA 2 of 5, Data Logic 2 of 5, Matrix 2 of 5, COOP 2 of 5), Interleaved 2 of 5(ITF, Code 2 of 5 Interleaved, USD-1, USS-Interleaved 2 of 5), Code 11(USD-8), Codabar(Rationalized Codabar, Ames Code, NW-7, USD-4, USS-Codabar, Monarch, Code 2 of 7), Plessey(Anker Code), MSI Plessey(MSI, MSI Modified Plessey), Telepen(Telepen Alpha, Telepen Full ASCII, Telepen Numeric), Channel Code, PosiCode (PosiCode A, PosiCode B), BC412 (BC412 SEMI, BC412 IBM), GS1 Composite Components CC-A, CC-B, CC-C(EAN-13 Composite, EAN-8 Composite, UPC-A Composite, UPC-E Composite, GS1 DataBar Omnidirectional Composite, GS1 DataBar Stacked Composite, GS1 DataBar Stacked Omni Composite, GS1 DataBar Truncated Composite, GS1 DataBar Limited Composite, GS1 DataBar Expanded Composite, GS1 DataBar Expanded Stacked Composite, GS1-128 Composite), HIBC barcodes(HIBC Code 39, HIBC Code 128, HIBC Data Matrix, HIBC PDF417, HIBC MicroPDF417, HIBC QR Code, HIBC Codablock F)

2) Using JSPOST Device type

for Japanese language support

As I did come across QR codes in Japan I thought I would blog on how I used the Japanese postscript device type driver with QR codes.

So the intention of using this version of the BWIPP device type is to show the way to use Japanese in the output including a QRcode.


When I used Japanaese with the original method using cutepdf the output would look like the following screenshot.



So to get Japanese to print properly then the SAP Postscript font file from this note was required.


Note 83502 - Printing Support for Native Languages


I downloaded the Japanese font file "Japanese  |  JPSPOST    | Dfnsjis  (note 83502)"


Follow the note to set the required parameter and upload the font to the SAP server.

*Check the limitations of using these device types in the note and that the font file will be sent to the frontend with each print.


The end result when using the QRcode enabled device type.




Smartform Example.



Steps involved.


1) Download the font file and set the parameter from the SAP note. Restart the SAP server


2) Download here  the zip file which contains the following files.

ZQR_PRINT_JP.txt     = ABAP code to produce a QRcode using the ZJPSPTQR device type.

ZBWIPP_JAPAN        = Output Device linking the device type to cutepdf desktop printer

ZJPSPTQR.PRI           = QRcode enabled SPOST Device Type


3) Use the original post in relation to the QRcode but use the above files to enable Japanese.


4) Run report ZQR_PRINT_JP (and make sure that print immediately is active).


with QRcode Kanji Encoding


The BWIPP can now encode Kanji into the actual QRcode, so a combined ASCII85 and BWIPP updated version can be found in the zip file for the Japanese device type download above. The link again here. In the subdirectory "japan kanji" device type ZJPSPTQK, can be uploaded and I have updated the ABAP code (ZQR_PRINT2KAN) with kanji for a demonstration as shown below.

The ABAP code now as Kanji in the line that generates the QRcode, as per the following screenshot.

Results in the following PDF with Kanji encoded in the QRcode.


3) Server side BWIPP

This version merges the BWIPP on the SAP server side. Therefore there is no need to configure PDF software or use scripts to introduce the BWIPP to generate barcodes. Server side integration allows the possibility to print direct to a postscript printer.

By using standard SAP configuration the BWIPP can be merged into the SAP output stream on the server side. Therefore reducing any configuration on the client side by placing the configuration  on any SAP application server used for printing.

Also as the solution is purely postscript based ANY postscript 2 compatible printer can be used for a barcode solution. While I no longer have access to any HP printers, I did cover this at a previous location and posted elsewhere in regards to printing postscript on HP printers.

Steps involved.

1) Download this zip file which contains.

ZBWIPP_M.PRI This is the SAP device type which contains the BWIPP configuration

Dbwipp This file is the Barcode Writer in Pure Postscript

ZBWIPP_PRINT.txt This is the ABAP code which produces 26 barcodes on one page


The test page looks like this.




2) SET the profile parameter 'rspo/devinit/datafile' to

rspo/devinit/datafile =
     /usr/sap/$(SAPSYSTEMNAME)/$(INSTANCE_NAME)/data/D++++++++

Note: Please pay attention to the number of "+" after the letter "D".
*Its important the the parameter is set exactly as above

3) Copy the Dbwipp file to the following directory on the SAP server
/usr/sap/$(SAPSYSTEMNAME)/$(INSTANCE_NAME)/data

*the parameter and Dbwipp file need to be set/copied to all application servers used for printing.

4) RESTART the application server

5)Follow this original post in regards to a standalone QRcode solution but CHANGE the following steps.

Import device type = ZBWIPP_M.PRI
Use ABAP code = ZBWIPP_PRINT.txt


*the output device qrcodes and cutepdf setup can be used as stated in the blog post. (They can be renamed as required)

Run the report ZBWIPP_PRINT for the demo ABAP code.

Here is a video covering barcodes in SAP Smart Forms with the BWIPP. The video was in the original blog post but got lost in the move to the new SCN.

Follow me onGoogle+

30 Comments
Labels in this area