QR Code SAP Device Type using Barcode Writer in Pure Postscript
Ever since coming across a QR code in my passport I have wanted to integrate them into SAP. I like the idea of a "quick response" of data into a mobile device as I hate typing on mobile phone keyboards. Now this is a technical solution and no business case is provided, however the flight demo SAP sapscript and smartforms which will be covered later offer an interesting use of QR codes (in my opinion).
Still unsure about QR codes, then try the Wikipedia link
See them in action here with Google's favourite places advert
Ever since coming across a QR code in my passport I have wanted to integrate them into SAP. I like the idea of a "quick response" of data into a mobile device as I hate typing on mobile phone keyboards. Now this is a technical solution and no business case is provided, however the flight demo SAP sapscript and smartforms which will be covered later offer an interesting use of QR codes (in my opinion).
Still unsure about QR codes, then try the Wikipedia link
See them in action here with Google's favourite places advert
All download files now on GitHub https://github.com/rjruss/SAP-QR-Code-and-other-2d-Barcode-Device-Types/tree/main
I am more of an system integrator/administrator than a developer so I found,
*) the application to do the actual QR code generation, Terry Burton's Barcode Writer in Pure Postscript, here
*) For simplicity I use the Cute PDF writer to generate the PDF via SAPlpd. A mention must go out to Ghostscript as this is used to do the actual QR Code PDF conversion. So this needs to be installed as per the instructions for Cute PDF writer.
*) Configure ABAP list program/SAPSCRIPT/SMARTFORMS to use the device type printer controls to generate the QR Codes.
Here is how to generate QR codes in SAP.
The ZBWIPPQR.PRI is a plain text file which you can open with any text editor to check it out.
2) Import output device FILE = zbwipp.txt
Download text file ZBWIPP.TXT for import here
next screen enter ZBWIPP.txt as the file name (use the directory where you downloaded the file)
3) Install Cute PDF writer from here
(direct download here http://www.cutepdf.com/download/CuteWriter.exe )
It is important to install with the PS2PDF option, so answer yes at the following prompt.
RENAME Cute PDF Writer printer to qrcodes as shown here.
Before
After
Why rename the printer to qrcodes?
This must be renamed to qrcodes to match the imported output device as shown below in the SPAD output screen. (SAPLPD will now use the printer qrcodes, in this way it does NOT interfere with any other SAP frontend printer settings you may have).
5) To enable frontend printing please ensure the user settings for spool control are set to "output immediately" in SU01.
Defaults TAB screen shot of the setting required. (make sure it is set, log off and check it again :)
6) Import the following example ABAP code to test QR codes in SAP.
From transaction SE38 create ABAP report ZQR_PRINT.
Cut and paste the text from this file found here ZQR_PRINT
Ignore any warning only messages relating to NEW-PAGE PRINT ON, this is purely used as a simple method to allow the ABAP code to use the printer controls in the device type.
Activate the program as the message is only a warning. This is only a test for ABAP list prints.
Now run the ZQR_PRINT report
Select ZBWIPP as the output device in the following print parameter screen.
*please note that the options shown here purely depend on the options you have active in the user settings. So its important, as previously stated, to have already set print immediately as one of the options.
After selecting the green tick mark, then after a short while you should have a prompt to save a PDF file.
7) The actual QR Code PDF document should look something like this....
8)... to be continued and the simple next step to use the printer controls in SAPSCRIPT and SMARTFORMS.
The YouTube videos for smartforms and sapscript now below....
*the video also shows other barcode examples.
1) The DataMatrix device type can be downloaded here
2) The Aztec Code device type can be downloaded here
*Not shown in the video but also available
3) The MaxiCode device type can be downloaded here
I am more of an system integrator/administrator than a developer so I found,
*) the application to do the actual QR code generation, Terry Burton's Barcode Writer in Pure Postscript, here
*) For simplicity I use the Cute PDF writer to generate the PDF via SAPlpd. A mention must go out to Ghostscript as this is used to do the actual QR Code PDF conversion. So this needs to be installed as per the instructions for Cute PDF writer.
*) Configure ABAP list program/SAPSCRIPT/SMARTFORMS to use the device type printer controls to generate the QR Codes.
Here is how to generate QR codes in SAP.
1) SPAD - Import device type FILE=ZBWIPPQR.PRI
You can download the ZBWIPPQR device type here
On the next screen enter ZBWIPPQR as the device type name
The ZBWIPPQR.PRI is a plain text file which you can open with any text editor to check it out.
2) Import output device FILE = zbwipp.txt
Download text file ZBWIPP.TXT for import here
next screen enter ZBWIPP.txt as the file name (use the directory where you downloaded the file)
3) Install Cute PDF writer from here
(direct download here http://www.cutepdf.com/download/CuteWriter.exe )
It is important to install with the PS2PDF option, so answer yes at the following prompt.
RENAME Cute PDF Writer printer to qrcodes as shown here.
Before
After
Why rename the printer to qrcodes?
This must be renamed to qrcodes to match the imported output device as shown below in the SPAD output screen. (SAPLPD will now use the printer qrcodes, in this way it does NOT interfere with any other SAP frontend printer settings you may have).
5) To enable frontend printing please ensure the user settings for spool control are set to "output immediately" in SU01.
Defaults TAB screen shot of the setting required. (make sure it is set, log off and check it again :)
6) Import the following example ABAP code to test QR codes in SAP.
From transaction SE38 create ABAP report ZQR_PRINT.
Cut and paste the text from this file found here ZQR_PRINT
Ignore any warning only messages relating to NEW-PAGE PRINT ON, this is purely used as a simple method to allow the ABAP code to use the printer controls in the device type.
Activate the program as the message is only a warning. This is only a test for ABAP list prints.
Now run the ZQR_PRINT report
Select ZBWIPP as the output device in the following print parameter screen.
*please note that the options shown here purely depend on the options you have active in the user settings. So its important, as previously stated, to have already set print immediately as one of the options.
After selecting the green tick mark, then after a short while you should have a prompt to save a PDF file.
7) The actual QR Code PDF document should look something like this....
8)... to be continued and the simple next step to use the printer controls in SAPSCRIPT and SMARTFORMS.
The YouTube videos for smartforms and sapscript now below....
*the video also shows other barcode examples.
1) The DataMatrix device type can be downloaded here
2) The Aztec Code device type can be downloaded here
*Not shown in the video but also available
3) The MaxiCode device type can be downloaded here
*Check out the general page for more information in regards to barcode printing in SAP with the Barcode Writer in Pure Postscript
Check out my SCN blogs here.
SAPSCRIPT Video
If you are interested in the following screenshot, then follow this link.
43 comments:
Hi,
this blog is perfetc!
Only a question, how output device ZBWIPP_DM must be defined?
I need to print data matrix 2d code.
Thank you in advance.
Best regards
Lucia
Hello Lucia,
I take it your have downloaded the datamatrix device type (http://bitly.com/sapdatam). You need that device type for datamatrix. (import as per step 1 above)
Then you need to change (or copy) the output device ZBWIPP and point it to the datamatrix device type.
So for example copy ZBWIPP to ZBWIPP_DM and then set the device type to ZBWIPPDM. *it would use the same qrcodes front end printer, which is fine and would work. However you could rename the front end printer and output device to match (as shown in the "Why rename the printer to qrcodes?" section)
Best Regards
Robert
Happy to help further if you need any more info.
Hello Robert,
I'm trying to do the PDF conversion with SAP FM 'CONVERT_OTF_2_PDF' but the QR code is not converted, it just converts the embedded text, do you have any idea of what I need to do?
Thanks,
Hector
Hello Hector,
The qrcodes are generated with postscript with the Barcode Writer in Pure Postscript.
So the conversion needs to be OTF to Postscript and then to PDF. The OTF to postscript conversion is done by the SAP device type (ZBWIPPQR). The postscript conversion to PDF is done by cutepdf writer in this blog example.
This means that 'CONVERT_OTF_2_PDF' does not do the OTF to postscript part. So will not work.
The technical details of the postscript used is covered in my SAP SDN blog http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/21446
Happy to help further if you need any more info.
Best Regards
Robert
hi Hector,
im able to get the barcode as per above steps, but when i scan the QR code there is no information, its blank.can you please tell me if am i missing something.
thanks
Hi , this comment was marked as spam so not sure if it's genuine .
If the comment is genuine can you let me know if you followed ALL the steps in this blog.
Thanks
Robert
Hi Robert.. I followed the same steps as in the video for my smart form..but the QRcode is overlapping and with the text i want it to be in QRcode..can you please..thanks in advance.
Hi, I will guess that you are looping around in a table with the qrcodes. Worth trying a standard window with a text box and put the print controls around that as a test.
Also most likely two issues covered in the following link will fix the problem you have.
http://www.rjruss.info/2011/10/sap-troubleshooting-qr-codes-in-smart.html
Let me know how you get on or any further comments.
Cheers
Robert
Hi Robert.. thanks for your reply..it seems working fine now..thanks a lot for your help..
Hi Robert,
Many thanks for those clear explanations.
With Sapscript, it was more difficult, i have to insert a space line after the print-control to obtain a Datamatrix.
Just a question: is it possible to print a 14x14 or 28x28 datamatrix, instead a 10x10 ?
Thanks in advance,
Jean
Hi Jean,
Good to hear you managed to print datamatrix barcode with sapscript.
Your question "is it possible to print a 14x14 or 28x28 datamatrix, instead a 10x10 ?"
Take a look here at the Barcode Writer in Pure Postscript wiki for Datamatrix.
http://code.google.com/p/postscriptbarcode/wiki/DataMatrix
On this page there are options for 14x14 but not 28x28.
Therefore lets use 14x14 & 32x32 as an example and setup these in the SAP datamatrix device type.
We need to reference the options "rows=14 columns=14" & "rows=32 columns=32" as print controls.
Start transaction spad and select the ZBWIPPDM device type.
Select the Print Controls TAB.
Hit the change icon and scroll down to and select the "ZOP02" print control
Hit the + icon to insert a row (ctrl+F6)
A new row should open and enter ZOP03 as the print control NAME
In the "Control character sequence" add the following
/bcopt (rows=14 columns=14) def\n
if required add a new row with ZOP04 with the rows=32 columns=32 options.
I tested with a quick abap report and should work fine for sapscript by using the new print controls as follows.
...
...
skip 6.
PRINT-CONTROL FUNCTION 'ZBW01'.
PRINT-CONTROL FUNCTION 'ZOP03'.
WRITE: 'test' NO-GAP.
PRINT-CONTROL FUNCTION 'ZBW02'.
skip 6.
PRINT-CONTROL FUNCTION 'ZBW01'.
PRINT-CONTROL FUNCTION 'ZOP04'.
WRITE: 'test' NO-GAP.
PRINT-CONTROL FUNCTION 'ZBW02'.
....
....
*You should note, with the new print controls you really need to know the maximum amount of characters you pass to the device type. As standard BWIPP to sizes the datamatrix to the correct size depending on the amount of characters passed to encode. If you send too many characters to a barcode that is limited in size you will not see any barcode in the printout/pdf.
Also back to your original comment, if you don't mind expanding on "i have to insert a space line after the print-control to obtain a Datamatrix". May help someone else if you can explain how you add that space line in a bit more detail.
Happy to help (if I can :) if you have further questions.
Best Regards
Robert
Hi,
I managed to print QR code via sapscript.
But charset is broken. Some characters are misprinted (Č,Ž,Š).
In output device options for ZBWIPPQR
I was trying to change charset from original 1117 to Central European (1404), and UTF-8.
It is possible to printout characters like "Č,Ž,Š" in your printer. And if it is, how can I do that.
Thank yout
Hi Michal,
Never looked into Central European language requirements before but I am interested to see what can be done.
ZBWIPPQR is a direct copy of POST2 postscript device type in SAP.
So if we can identify a POSTSCRIPT device type that can print those characters adding BWIPP should be very simple.
Therefore identifying the device type to start with is the issue. A quick search of SAP notes I came across this one.
Note 575916 - PostScript device type for ISO 8859-2 (Latin-2) and HP
It is an *obsolete* note but indicates that SAP only produced a device type for HP printers.
I will do some tests, however in the meantime
1) do you use HP printers?
2) How do you print at the moment, dedicated printers or via windows frontend.
3) which device types in SAP do you currently use.
Cheers
Robert
Dear Robert,
I successfully followed your posts regarding ZBWIPPDM device type and managed to print out data matrix barcodes with smartforms :-)
However, during the implementation of a specific business scenario I came across two major issues:
1). Currently we are using HP printers via windows frontend in our environment. As you pointed out earlier in replay to Michal Veščičík, POST2 printer used for ZBWIPPDM device type is Latin-1 and therefore Central European chars are not displayed correctly. I found SAP note "Note 575916 - PostScript device type for ISO 8859-2 (Latin-2) and HP" which includes device type ZI2HPPS.PRI and I wonder if it is possible to merge it somehow with ZBWIPPDM to enable printing of CE specific characters?
2). I need to produce the data matrix barcode based on the following data structure (AI stands for Application Identifier like in EAN128): (AI '10') + 10 chars of data + (AI '240') + 18 chars of data + (AI '3142') + 6 chars of data + (AI '400') + 8 chars of data. For EAN128 I programmed these AIs as special FN codes but since I am not familiar with data matrix encoding I failed with issuing correct data string to ZBWIPPDM (barcode is not appearing on the printout at all). What would be the correct set of control commands between 'ZBW01' and 'ZBW02' to have a correct data string (incl. FN codes) passed to ZBWIPPDM in this particular case?
Best regards,
Grzegorz
Hi Grzegorz
Good to hear you managed to print out the data matrix barcodes on your system.
As for your questions
1) I would ask that you setup and print with the device type ZI2HPPS.PRI in its original form. e.g. with no changes and no
barcodes at this stage. This is in order to print via smartforms with the required CE specific text. Also use exactly the
same method to print as you used with ZBWIPPDM. If you can generate the CE specific characters and the output is acceptable
to you then it should be relatively simple to add the barcode writer in pure postscript to generate any barcodes. Another
reason I ask you to try ZI2HPPS.PRI in it's pure form is that SAP normally use the bitmap fonts for the language support
for postscript device types. This means if you are using PDF's then the text will appear as an image in the PDF. If you are
using HP printers then I do know from before there is a possibility that the printer may have a postscript driver. In which
case you could print direct to an HP printer.
So
If you want to do the direct test with ZI2HPPS.PRI and you let me know you are happy with the results. We can move onto the
next step and add the barcodes.
2) Its always worth checking the barcode writer in pure postscript pages. As depending exactly on the format you need check
out these pages
Standard Datamatrix (this is the base for ZBWIPPDM)
http://code.google.com/p/postscriptbarcode/wiki/DataMatrix
and this type of datamatrix which could be created.
GS1 DataMatrix is an implementation of Data Matrix ECC 200 with GS1 formatted data.
http://code.google.com/p/postscriptbarcode/wiki/Gs1DataMatrix
Also using the parse option could a possibility. Have a read of my very last comment on my page here.
It covers the ^nnn style notation for special characters.
http://www.rjruss.info/2011/10/sap-troubleshooting-qr-codes-in-smart.html
There is also another option in adding a brand new print control for the following from the datamatrix wiki.
"When the parsefnc option is specified, non-data function characters can be specified by ^FNC1 through ^FNC6"
Let me know on the above and happy to help out further if required.
Cheers
Robert
Hi Robert,
Thank you for your prompt reply, I followed your advice and issued the printout to ZI2HPPS.PRI instead of ZBWIPPDM.PRI. I can confirm that the result is satisfactory - all non standard characters were printed out correctly. I think we can now move to the next step and add the barcodes :-)
Best regards,
Grzegorz
Hi Grzegorz,
Adding the barcodes should be straightforward, I have some time over the weekend and will download ZI2HPPS.PRI myself and test it out. I will get back to you via this comment section. Should have something fairly quickly to share here.
Regards
Robert
Hi Robert,
i have tried the same thing for smartforms but every time it gives me a same output with different value on mobile(Barcode Scanner).
Brcode is getting scaned but values are not coming. If i pass the same value from report it gives me proper output.
Please help me
Hi,
I would like to help but would need more information on what steps you have taken in smartforms. However I would point you to this page
http://www.rjruss.info/2011/10/sap-troubleshooting-qr-codes-in-smart.html
All known issues have been fixed that I know of by following the steps in the above link.
Regards
Robert
Hi Grzegorz,
I did read the SAP note related to the device type and downloaded the ZI2HPPS.PRI device type. It does appear dedicated to the printers so any tests for the CE characters would have to be on your side.
Although it is postscript and a quick test proves it can be integrated with barcode writer in pure postscript. In the first instance it would be easier to setup along the lines of the following post.
http://www.rjruss.info/2011/10/printing-barcodes-for-free-with-sap.html
I could have a first version of ZI2HPPS.PRI with the barcodes integrated very soon.
So if you are still interested, let me know and maybe we move to email exchange as it may be easier to continue tests and setting it up that way.
Regards
Robert
Hi Robert,
Thank you so much for looking into ZI2HPPS.PRI device type and for the wonderful news regarding its compatibility with the barcode writer. Of course I am still interested in your help and moving to email exchange sounds very reasonable. Here is my email address: develooper.sap#!#gmail.com (please replace #!# with @). In the meantime I will go through the post you mentioned in your replay.
Regards,
Grzegorz
Hi Robert, as it turns out the barcode writer works perfectly with device type ZI2HPPS.PRI, diacritical marks and data matrix barcodes are printed out correctly together. Once again, I would like to thank you for your help and support :-)
Cheers,
Grzegorz
Hi Grzegorz,
Thanks for taking the time to comment on the blog and good to hear that it worked out and met your requirements.
Cheers,
Robert
Hi Robert, is there a step by step explenation for beginners as well? I would really appreciate a lot to print qr code out of sapscript and maybe one day out of smartforms... if I learn how...
Many Thank's!!!! Marzia
Hi Marzia,
how about you send me an email as maybe we need to determine the level of help you think you need. Email would be better for that.
You can find my email address at the following SCN link.
http://scn.sap.com/people/robert.russell2
Regards
Robert
HI Robert,
Can you please tell me how to provide a tab between two line
For Example My Internal table contains 2 line
Line1 - : "This"
Line2 - : "Is"
after scanning barcode & looking into notepad it should be separated by tab as below
This is
Thanks in Advance
Hi Paresh,
A quick search via google and you need to pass 9 for horizontal tab, in exactly the same way you passed 10 & 13 for carriage return, line feed via the parse option.
Regards
Robert
Thanks Robert,
You are right on trail & error basis i passed ^009 & as of now it is working fine.
By the time of testing you replied.
Once again thanks for quick reply.
Regards,
Paresh
Hi Robert,
Is there any restriction on number of characters in barcode to be printed.
My Barcode conatains more then 230 characters.
In this case, Barcode is getting printed in some case & for some case it is not getting printed
Sorry for giving you problem again.
Thanks is advance.
Paresh
Hi Paresh,
Not sure exactly what you are trying to do but if you position and size the qrcode correctly on the page or in a window then it should be ok with the number of characters passed. I would suggest you need to know exactly the amount of characters each time (e.g. pad the text if necessary to a known length) then you a dealing with consistent data.
Regards
Robert
Hello Robert,
I download and install it , it can be printed QR code. very good ,thank you!
But I found that if the content contains Chinese, it will be garbled.
Why do not support Chinese ?How can I do?
Paso
Email:123loading@163.com
Hi Paso,
I suggest you read my blog in regards to Japanese and barcodes here
http://scn.sap.com/community/output-management/blog/2012/08/08/barcodes-in-sap-with-the-barcode-writer-in-pure-postscript-update
Then you could follow a linking method described in my blog here
http://www.rjruss.info/2013/02/add-free-barcodes-to-sap-latin2-hp.html
I would suggest you test out a postscript device type that supports Chinese first. Stanalone without any barcodes and check the output is to your requirements. If it is fine then you could try the linking method described in the blog above.
Any further questions let me know, happy to help out where I can.
Are you happy that your email address is in the comments and would you want me to delete that?
Regards
Robert
Hi Robert, could this be use, with an printer, and configuring the label format?
Also, could we set trigers when every "x" item has an goods issue , been add to the company dababase we will print it?
Hi Mazze,
The QRcodes can be printed on a postscript printer or a printer that can support postscript via a driver. The label printing sounds possible although I am not sure I follow your requirement for every "x" item.
The QRcodes are produced via print controls so if you can program a print control every "x" item then it should be possible.
Regards
Robert
Robert, amazing job.
My Name is Adrian.
I've been able to print the QR codes like you instructed in this post, works like a charm!
But now i have a requirement to print the QR codes in a smaller size..
I have to print around 200 characters, and the size is too big for my client...
Is there any way I can print a barcode in a smaller size?
My client has a bardcode printer, can't remember the model now, could i use a Smartform to send it straigth to this printer, without using the cute pdf printer??
Thank you!
Hi Adrian,
Apologies for the delay other things took up my time.
So if you still care about my answer! here it is
You may want to review a reply I gave here about the size of qrcodes
http://scn.sap.com/community/output-management/blog/2012/08/08/barcodes-in-sap-with-the-barcode-writer-in-pure-postscript-update#comment-316259
The BWIPP does a great job in auto calculating the size of the required qrcode and trying to control it can lead to issues if you do not know the maximum number of characters passed to the qrcode.
Also the BWIPP was updated to produce qrcodes at an optimum size a post about that here
http://www.rjruss.info/2015/04/barcodes-in-sap-with-barcode-writer-in.html
The above post as a link to my updated device types with the qrcode optimised for size.
(also a few other options to use the barcode writer in SAP mentioned in that post)
Cheers
Robert
Hi Robert,
This is Thanu,
I am trying to send MAXI code as pdf attachment through Mail.
I have downloaded from and configured however the result is not I expected.
Would appreciate if you can guide me, how to achieve my requirement.
Regards
Thanu
Hi Thanu,
Not sure how exactly you are emailing from SAP however if the device type and postscript interpretar (ghostscript used by cutepdf) are bypassed then there will be no Maxicode produced. The requirement could be achieved outside of SAP with PDFCreator.
Along the lines of my post here
http://www.rjruss.info/2011/01/sap-barcodes-for-free-in-background-job.html
And check out the email options for pdfcreator ( I havent tried this method)
http://www.pdfforge.org/pdfcreator/manual/send-e-mail-over-smtp
Regards
Robert
Hi Robert
It was good document . We tried printing the UPS maxicode by downloading the device type.
When we printed using PDF creator it is working fine. Instead to printing the barcode we want to used smart form and trying to email the UPS label to customer by converting PDF inside the program, but barcode is not appearing correct.
Any suggestion.
Thanks
Arun prasad
Hi Arun,
Only option is to try outside of SAP as the SAP standard is OTF to PDF directly and misses out the postscript conversion required for the barcode.
Outside of SAP PDFcreator does offer an email option.
PDFCreator.
Along the lines of my post here
http://www.rjruss.info/2011/01/sap-barcodes-for-free-in-background-job.html
And check out the email options for pdfcreator ( I havent tried this method)
http://www.pdfforge.org/pdfcreator/manual/send-e-mail-over-smtp
Regards
Robert
Hi Robert
Thank you for the inputs , I will try on the same.
Also I came across your blog @ APRIL 2015
http://www.rjruss.info/2015/04/barcodes-in-sap-with-barcode-writer-in.html
Here it explain we can generate QR codes in smart form and preview.Is same possible in MAXICODE also
Hi,
Yes that blog's method should work with maxicode as well.
Regards
Robert
Hi thanks for all here.
My expirience: Installing SAP Sprint from SAP you can get rid of any of those PDF stuff - i was fighting for 2 days to make it print on different printer. So you need to install sap spring service, change in SPAD spool type to U (Berkeley protocol (BSD)) and you can specify any printer on any server you like and ii is working:). Without any "free" pdf software.
Bartek
Post a Comment