Wednesday, January 26, 2011

SAP: Barcodes for free in a background job with PDFcreator in server mode

Running the 26 barcodes on a page report in an SAP background job.

Created with the Barcode Writer in Pure Postscript

While I was setting up my SAP demo NW702 system and BWIPP, I was notified of a new version of PDFcreator (version 1.2). So I thought I would try PDFcreator in server mode (note I do run the demo SAP server on XP)

A prereq, you will need the device type and abap report found here

Import the device type ZBWIPP (file zbwipp.pri in the zip file) with transaction SPAD
Enter the device type name and SAP will prompt for a transport



Download PDFcreator

1) Choose server installation

2) note the advice in the next screen.

Let the install complete and I activated autosave and kept the default directory and settings.



3) Download the BWIPP in the "seperate file per named resource" in the download section.
 Install this into the lib directory of PDFcreator as shown. Installing in this way will allow the print after save option to work, but more on that later.

4) Setup the output device, I used the direct operating system call.
*Note the device Type must be ZBWIPP

5) create ABAP report ZBWIPP_PRINT (use the text file zbwipp_print.txt from the zip file) and you can ignore the warning message, it works and the new page print on command is required to use the printer controls for the barcodes.

activate the report and the following is only a warning message



6) define the background job in sm36 and point to the new printer, I had set the new printer as my default printer in SAP.

Run the report immediately or schedule and the resulting PDF print out should be in the auto-save directory setup earlier.



7) Print after save.

I am still checking this part out but the mswinpr2 device used by ghostscript is a completely separate and therefore no control over margins, so I scaled the printer to get some results, if you note the 98% scaling option in the screen shot.

I may return to this later........


 

Sunday, January 9, 2011

SAP: Thematic mapping with KML

I have blogged about visualising wikipedia data with Tableau before

Here I will keep the same source data but  process  it with SAP ABAP. The ABAP code will create a KML file for viewing in google earth or arcgis explorer or any other kml compatible program. Hopefully you can make the connection to presenting business data in the same way. e.g. its all in ABAP and therefore you could use the data in SAP, I am not in the position to show even the test data I used to demonstrate this at work.

So I will cover the thematic map with the population of Japan but this time in a choropleth map.  In later blogs I will cover how to produce a choropleth map based on first level admin breakdown of countries, basically later blogs will explain this more! (for now, you can see this 1st level admin in google earth by expanding borders and labels and 1st level admin is shown).

Wikipedia Data

Now to get the wikipedia data we will use sparql as before (in the Tableau blog mentioned at the start) but this time add  iso code related lines.


The ABAP code
I am not an ABAP developer but I have been scripting for long enough to try it out and get this demo working. So its not really about the ABAP code but the idea of presenting data on a map I want to cover.

The - not so - Simple Transformation

This is the key to the choropleth map its based on my kml breakdown of Japan by prefectures in KML ( the 1st level admin borders I mentioned earlier). Now in SAP regions for Japan match the ISO codes for Japan prefectures.

So the simple transformation for Japan is based on changing the colour of the polygon.

The ABAP code works out a range of colours based on the data and then runs the simple transformation changing the colours of the 47 prefectures. As per the snippet of code shown here.


<PolyStyle>

  <color><tt:value ref="cjp34"/></color>

  <outline>1</outline>

</PolyStyle>



The Video,
This is just a demo video at the moment and I will update this later. The video shows data being processed by SAP to generate the polygons and the colour based on a scale. In the video I change Kanagawa and Tokyo prefectures to change the colours of the polygons. This is a first blog in a series and I will cover more in later posts.

**Update 13th March, I have taken down the demo video due to the current situation in Japan.
**Update 19th May, new video with the scalable icons in KML, the polygon video will return later.
**A way to generate your own KML for any country based on the Natural Earth Dataset here


.


Background as to why I ended up doing the above.

What "themematic mapping in SAP with KML", I didnt think I was going to be at this point as I have always been in the SAP Basis side of things and never written an business based report before. During several meetings people were talking about reports based on postcodes, I took this idea of postcodes and started my Google Driven Development and trying to Keep It Simple Stupid at all times. However at the end there was no take up of the idea, we have a complete BI system about to arrive and a commercial mapping service. I am still working on the idea though as it is a great way to show data.

The original ideas for KML presentation came from the Thematic Mapping Engine.

Living in Japan was also the inspiration behind my idea, if you have ever been to Japan then you may know the streets have no names which is weird (or maybe different). So as per QR code adventures into SAP, you can thank Japan for inspiring me to write this blog :) I found myself interested in the whole mapping side of things as a way to try and understand more about Japan, I have not finished my mapping adventure, and there is more blogs to come.

I like this video as it covers the "weird or just different" aspect with Japan street names. (its a TED talk by Mr Sivers, youtube allows me to get the embed code so I am using it).

Wednesday, January 5, 2011

PDFCreator: configure pdfcreator to permanently include Barcode Writer in Pure Postscript

After a trip to Wikipedia and this page http://en.wikipedia.org/wiki/List_of_virtual_printer_software

I have a new favourite pdf virtual printer in PDFCreator. Its free and for commercial purposes and can be downloaded here

I had blogged about 26 barcodes on one page with scripts based around Redmon, Microsoft services for Unix and Ghostscript.

PDFCreator can also add the barcode.ps file required to allow SAP to use the Barcode Writer in Pure Postscript without further scripting and bypass Microsoft services for Unix. (it appears redmon is used by pdfcreator as a default install)

Here is the screenshot of the config required.




In the example above the barcode.ps file is in directory C:\Program Files\PDFCreator\GS9.00\gs9.00\Bin, but can be placed in any directory with the search path set correctly.

The PDFCreator has a few more config options that I like such as the auto save shown below.


CutePDF can do the same thing here which allows the ABAP report to produce the following output.


Google +