Skip to Content

Ever since coming across a QR code in my passport  (http://en.wikipedia.org/wiki/Passport_stamp#Use) 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. This starting point lead me to a zebra crossing and then onto the Barcode Writer in Pure Postscript  (http://www.terryburton.co.uk/barcodewriter/). The Zebra Crossing   (http://code.google.com/p/zxing/)will be covered elsewhere. However through my interest in QR codes I found a method to introduce the wide variety of barcodes found in the Barcde Writer in Pure Postscript into SAP.

Now this is a technical solution and no business case is provided, but if you need or want a barcode for any reason then I am sure it will be covered in some form by the Barcode Writer in Pure Postscript. Obviously SAP includes standard barcodes, and the ADS is available. However if you want a barcode, that is available in the BWIPP and not standard SAP, for SAPscript, smartforms or ABAP list with printer controls then you could try the following method. As the solution is purely postscript based, the barcode can be printed on any postscript level 2 compatible printers. However this blog focuses on a Windows desktop solution by generating a PDF document with the barcode.

An overview of the process to an open source/freeware based barcode  in standard SAP.

) The application to do the actual barcode generation is Barcode Writer in Pure Postscript  (http://www.terryburton.co.uk/barcodewriter/postscriptbarcode.zip) (BWIPP).</p><p>) Configure ABAP list program/SAPSCRIPT/SMARTFORMS to use the device type printer controls to generate the barcode(s).

) For simplicity I use the Cute PDF writer  (http://www.cutepdf.com/products/cutepdf/writer.asp) to generate a PDF via SAPlpd. A mention must go out to Ghostscript as this is used to do the actual barcode PDF conversion. So this needs to be installed as per the instructions for Cute PDF writer.</p><p> </p><p> </p><p>So to list the steps covered in this blog,</p><p>)  Identifying the text to convert into a barcode.

)  Integrating the BWIPP code with the SAP output (through a device type). </p><p>)  Pass the text to the BWIPP code to produce the barcode.

)  Generate a PDF with the Barcode.</p><p> </p><p>_Identify the Text for the Barcode_</p><p>For example if we use the following text</p><p> “This is some text that we want to turn into a barcode” </p><p>in smartforms, sapscript and ABAP list and pass it through a SAP printer with the POST2 device type. The postscript output is sent to a file so we can check the generated postscript encoding.</p><p>1) smartforms (ASCII85  (http://en.wikipedia.org/wiki/Ascii85) encoding), internet sites to decode ASCII85 can be found here  (http://www.tools4noobs.com/online_tools/ascii85_decode/) or here  (http://www.webutils.pl/index.php?idx=ascii85).</p><p><~<oueDGm>F)Po,+EV1>F<G[=@<<W9AKZ2DKI!> s</p><p><FDi:DF`M@BBl8$2CQC%@<,jrA7Y> s<br /> <br />2) sapscript (again ASCII85 encoding)</p><p><<oueDGm>F)Po,EV1>F<G[=@<<W9AKZ2DKI!> s</p><p><FDi:DF`M@BBl8$2+CQC%@<,jrA7Y> s </p><p>3) ABAP list (HEX  encoding), an internet site to decode HEX to string can be found here</p><p><5468697320> s<br />3016 950 mt<br /><697320736f> s<br />3016 1660 mt<br /><6d65207465> s<br />3016 2370 mt<br /><7874207468> s<br />3016 3080 mt<br /><6174207765> s<br />3016 3790 mt<br /><2077616e74> s<br />3016 4500 mt<br /><20746f2074> s<br />3016 5210 mt<br /><75726e2069> s<br />3016 5920 mt<br /><6e746f2061> s<br />3016 6630 mt<br /><2062617263> s<br />3016 7340 mt<br /><6f6465> s</p><p>Now from the above list the actual text  is split across a number of lines and appears with “s” at the end of the line. The “s” is actually a defined postscript procedure for the postscript show command. The “mt” line in the ABAP list is another postscript procedure for the moveto command. Both these procedures will be important to note for later reference.</p><p>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.  </p><p>_Integrating the BWIPP into an SAP device type_* 

What follows is how to integrate the BWIPP into a device type. For reference you can check out the one I prepared earlier. The device type is for the QR Code barcode called ZBWIPPQR.

http://bit.ly/zbwippqr

The link points to a text file ZBWIPPQR.PRI, which can be imported through transaction SPAD.

!https://weblogs.sdn.sap.com/weblogs/images/251909024/1SPADimportdevicetype.png|height=123|alt=|width=320|src=https://weblogs.sdn.sap.com/weblogs/images/251909024/1SPADimportdevicetype.png|border=0

Enter ZBWIPPQR as the object name and the system will then prompt to create a transport.

There are a few options on how to introduce the BWIPP code into the SAP output to generate the barcode. One way is with client or printer side scripting to insert the code prior to further processing. Another way is to insert the code into an SAP device type.

Inserting the code into the device type allows direct use of the Cute PDF writer without extra client side scripts/configuration. So this blog focuses on this method. I could expand on the options available in subsequent posts, depending on feedback.

SAP device types have some built in limitations that make the use of the postscript BWIPP code harder than a simple cut and paste of the code. However it is possible to integrate the BWIPP into a device type. It should be clear but to clearly state, inserting postscript programs is outside normal SAP helpdesk support.

The way a page is printed in SAP is linked to so called formats in a device type. If you take a look into a format of POST2 it looks like the following. 

Run transaction SPAD-> extended administration-> Device Types

Select Formats

Double click on DINA4, which the SAP demo programs for sapscript and smartforms use.   

Double click on ACTION Printer initialization

If you note the way the DINA4 format ACTION initilization makes a reference to another device type format with \i.  So the POST2 device type uses the POSTSCPT device type’s initialization ACTION. This method of reference is used to introduce the BWIPP into SAP by referring to a number of formats sections due to the limitations in SAP. Also refer to the ACTION +end of line +(not shown).  This is used to integrate the BWIPP with the end of line  \n reference.

If you take a look at POSTSCPT format DINA4. Then the initialisation section is also the place where SAP define a number of postscript procedures, if you search the code you will come across “s” and the “mt” procedures mentioned earlier. These procedures play an important role in generating the barcodes.

ACTION page limitations

The limitations found in any ACTION page are that they are limited to 72 characters per line ,  can have a total of 255 lines and any white space at the end of a line will be truncated.

Formatting BWIPP so that it can be Inserted into the Device Type

After downloading BWIPP we need to use the barcode.ps file as this contains all barcodes supported by the BWIPP. We need to extract the appropriate code for the barcode required. The barcode.ps comments and format make it easy to extract this code.

Take QR Code as an example and the barcode.ps first needs to be manually split into 3 files. The code sections required would appear in the following text files.

1) The credits/copyright notice 

Create a new file with the code between the following lines of barcode.ps

%!PS-Adobe-2.0

   – make sure not to copy this line.

….

….

….

% END PREAMBLE

2) The encoder – generates a structured representation of the barcode

Create a new file with the code between the following sections of barcode.ps

% BEGIN ENCODER qrcode

% –DESC: QR Code

% –EXAM: http://www.terryburton.co.uk/barcodewriter/

% –EXOP: eclevel=M

% –RNDR: renmatrix

…..

…..

…..

% END ENCODER qrcode 

3) The renderer – takes the output of the encoder and generates the visual representation of the barcode.

The renderer required is stated in the encoder section of the file, so for QR Code we need the +renmatrix +renderer.

Create a new file with the code between the following sections of barcode.ps.

% BEGIN RENDERER renmatrix

…..

…..

…..

% END RENDERER renmatrix

So due to the limitation in the ACTION pages described earlier, then you need to manually split the code into lines no longer than 72 characters and the number of lines of each file is less than 255.  Also add the \n to the end of the line and check that no lines end with a space….

Or

 If you have a UNIX system then the following korn shell script can do this for each file.

#!/bin/ksh

#This script requires  that the maximum

# line size to be less than 140 characters.

  1. to overcome the ACTION page limitation, it splits lines greater than 71 characters

#adds a space to the start of the next line if the previous line ended with a space

# and splits the file every 250 lines.

#uncomment the next line for the credits file 

 #egrep -v “^$” $1 |sed “s/$/

\n/” | awk ‘{

#

#uncomment the next line for the encoder and renderer files.

#egrep -v “$|%” $1 |cut -f1 -d’%’ |sed “s/$/

\n/” | awk ‘{

if ( length($0) > 71 )

{

        print substr($0,1,71)

                if ( substr($0,71,1) == ” ” )

                        { print ” “substr($0,72) }

                else

                        {print substr($0,72)}

} else {print $0}

}

‘ |split -l 250 –  $.

You need to run this script against the 3 files, making sure not to remove all the comments from the credits file.  Filenames generated should have the following naming convention

encoder.ps.aa

encoder.ps.ab

Etc.

_ _

Inserting the BWIPP code into an SAP Device Type

Now we need to COPY POST2 device type to a new device type, for example called ZBWIPPQR.

Then we need to cut and paste the code into the ACTION page for the chosen format DINA4.

As shown below the QR code example required

1 ACTION for the credits

4 ACTIONs for the encoder

1 ACTION for the renderer

If the split of the encoder file was done with the UNIX script then

ZENC1 equals encoder.ps.aa

ZENC2 equals encoder.ps.ab  

ZENC3 equals encoder.ps.ac

ZENC4 equals encoder.ps.ad

To include these ACTION pages in any SAP output then we need to reference these in the initialization ACTION page as shown below.

<u>Passing the Barcode Text to the BWIPP</u>

First let’s take a look at the printer controls of the SAP standard device type POST2 as we will follow this method used by SAP to control the BWIPP.

Screen shot of selected printer controls of POST2

Printer control SPMSI  uses PrintModeSimplex in plaintext.

This links to a postscript procedure in the initialisation ACTION code.

!https://weblogs.sdn.sap.com/weblogs/images/251909024/11showinitpagelink.PNG|height=238|alt=|width=539|src=https://weblogs.sdn.sap.com/weblogs/images/251909024/11showinitpagelink.PNG|border=0

So now we have the BWIPP code in a device type then we need to actually use the BWIPP to generate the barcode at an appropriate place with the correct text. This will be achieved by using print controls to call postscript procedures in the same way as the SAP method above.

The postscript procedures to use BWIPP will be added to the CREDITS  ACTION PAGE.

These procedures are called at the required place via printer controls in smartforms or sapscript.

##usage: CREDITS

##DO NOT CHANGE the first two lines!

%% SAP device type put together by Robert Russell, \n

%% send any comments to rob.roosky@yahoo.com. \n

%% 2010 RJR……\n

/ctxt {\n

         2 copy length exch length add  % \n

           string dup     % string1 string2 string string\n

           4 2 roll       % string string string1 string2\n

           2 index 0 3 index\n

           % string string string1 string2 string 0 string1\n

           putinterval    % stuff the first string in.\n

           % string string string1 string2\n

          exch length exch putinterval\n

} def\n

/sqrd {bcopt /qrcode /uk.co.terryburton.bwipp findresource exec} def\n

/bct () def\n

/bchor 0 def\n

/bcver 0 def\n

/bcscx 1.0 def\n

/bcscy 1.0 def\n

/bcopt () def\n

/bcrot 0 def \n

/bwippst {\n

gsave\n

currentpoint translate\n

bcscx bcscy scale\n

bchor bcver rmoveto\n

bcrot rotate\n

} def \n

/bwippen {\n

grestore\n

/bct () def\n

/s {show} def\n

/bchor  0 def\n

/bcver  0 def\n

/bcscx  1.0 def\n

/bcscy  1.0 def\n

/bcopt () def\n

/bcrot 0 def \n

} def\n

All the postscript code is now in place in the initialisation process of the device type.

From the code above the

/ctxt  = this procedure is used to concatenate text. It is taken from the

postscript FAQ here

/sqrd  = this calls the BWIPP to create the barcode. In this example it creates a QRcode and needs to be changed to the appropriate command to call the desired barcode, check the BWIPP wiki page  (http://groups.google.com/group/postscriptbarcode/web) for the barcode required.

The first appearance of the following variables is to initialise the values.

/bct () def\n       The actual text used to create the barcode

/bchor 0 def\n      horizontal shift

/bcver 0 def\n      vertical shift

/bcscx 1.0 def\n    scale x axis

/bcscy 1.0 def\n    scale y axis

/bcopt () def\n     BWIPP options

/bcrot 0 def \n     rotation

/bwippst  = uses the variables to position/size the barcode 

/bwippen   = resets all variables and resets the “s” procedure to the show command.

Print Controls for the BWIPP

Print Control = ZBW01

The following postscript code

/s {bct exch ctxt /bct exch def}  def \n

This printer control should be placed before the text required for the barcode.

By using  “s” as a procedure we swap out the SAP procedure for “s” for the concatenate text procedure. This procedure will be called every time “s” appears in the postscript output.

For example in smartforms using the same text “This is some text that we want to turn into a barcode” . The code in postscript would appear as.

 <<oueDGm>F)Po,+EV1>F<G[=@<<W9AKZ2*DKI!> s

<FDi:DF`M@BBl8$2+CQC%@<,jrA7Y> s

 

Now by swapping out the show command for the concatenate procedure, we can build a variable “bct” with the text required. The same concatenate text procedure works for the ABAP list, so it does not matter how SAP splits the line for postscript processing. The concatenate text procedure will build the text required for every “s” line. When the ZBW02 command is called then the “bct” variable would contain +This is some text that we want to turn into a barcode in the above example.+

Print Control = ZBW02

The following postscript code

bwippst\nbct sqrd\nbwippen\n

This printer control should be placed at the end of the text required for the barcode.

The bwippst procedure sets up the position and size of the barcode. The “bct sqrd” passes the variable bct, which contains the final text from all the concatenation calls, to the BWIPP. One important action is the bwippen procedure which resets all variables and sets the “s” procedure back to the SAP show procedure.

Other Example Print Controls

Below are other print controls that can control the appearance of the barcode. There are more possibilities to create more print controls with postscript commands linked to the BWIPP procedures in the device type’s CREDITS ACTION page.

Barcode Position

The BWIPP code will generate the barcode at the current position on the page. E.g. if you recall all the “mt” calls in the ABAP list example earlier, this means that the output is at a certain position on the page. This is important as you need to pass consistent length of data to get a consistent position for the barcode. We can control the barcode size and position relative to the current position on the page. The consistent positioning is only possible if a known length of characters is passed every time within one print job.

Positioning the Barcode with Print Controls

Using the current position on the page we can move postscript points  (http://en.wikipedia.org/wiki/PostScript)

ZDN01            /bcver  bcver 1 sub def\n                 moves the barcode DOWN

ZUP01            /bcver  bcver 1 add def\n                 moves the barcode UP

ZLT01             /bchor  bchor 1 sub def\n                moves the barcode LEFT

ZRT01            /bchor  bchor 1 add def\n                moves the barcode RIGHT

Barcode Size

Allow enough room for the barcodes size in the smartforms cell or sapscript page. Carriage returns can be used before the actual text of the barcode to make the required space for the barcode. 

_Scale the Barcode with Print Controls

_The barcode can be scaled along the X and Y axis.

ZSX01 /bcscx bcscx 0.1 add def\n     expand barcode on  X axis

ZSX02 /bcscx bcscx 0.1 sub def\n     shrink barcode on X scale

ZSY01 /bcscy bcscy 0.1 add def\n      expand barcode on Y axis

ZSY02 /bcscy bcscy 0.1 sub def\n      shrink barcode on Y axis

Rotate Barcode with Print Controls

/bcrot  bcrot 45 add def\n                    rotate barcode 45 degrees

See the video at the end of this blog demonstrating the use of printer controls in smartforms.

<u>Generate a PDF with the Barcode</u>

To generate a PDF file with the barcode then Cute PDF writer  (http://www.cutepdf.com/products/cutepdf/writer.asp) needs to be installed. This is a freeware program that can be used for commercial purposes. This takes the output from SAP and processes the postscript file to generate the PDF with the barcodes.

During the install ghostscript needs to be installed, so answer yes to the following prompt.

!https://weblogs.sdn.sap.com/weblogs/images/251909024/14cutepdf.PNG|height=238|alt=|width=400|src=https://weblogs.sdn.sap.com/weblogs/images/251909024/14cutepdf.PNG|border=0

Next a Frontend output device needs to be created in SAP. To have a dedicated front end printer for barcodes then you can rename the Cute PDF writer to match the entry in the SAP output device. Here the frontend printer name matches the name of the printer on the desktop.

!https://weblogs.sdn.sap.com/weblogs/images/251909024/15frontendprinter.PNG|height=97|alt=|width=400|src=https://weblogs.sdn.sap.com/weblogs/images/251909024/15frontendprinter.PNG|border=0!</body>

To report this post you need to login first.

22 Comments

You must be Logged on to comment or reply to a post.

  1. Rene Pilz
    I’m wondering if there is any method to include such barcodes directly on a invoice – for example – which will be printed on a HPLJ ?

    We are going to introduce a link (QR or Datamatrix) on our papers where customers can get further information.

    (0) 
    1. Robert Russell Post author
      Hello, thanks for the comment,
      As for printing to non postscript printers then you could try…
      I have not tested these.
      1) Windows XP frontend virtual PS printer.

      2) Unix and CUPS, this wikipedia PPD link indicates that CUPS can print PS to non-ps printers.

      I have tried this…
      3)If you happen to have Solaris then I did try a bit of a low level postscript hack that worked on the HP printers at the office. I cant recommend it though but it is easy to setup.

      Regards
      Robert

      [1 windows|http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html]
      http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html
      [2 CUPS|http://en.wikipedia.org/wiki/PostScript_Printer_Description]
      http://en.wikipedia.org/wiki/PostScript_Printer_Description
      [3 hack|http://bit.ly/9T3N08]
      http://bit.ly/9T3N08

      (0) 
      1. Robert Russell Post author
        As we have HP printers I thought I would test direct printing.

        I have tested a postscript driver for HP4700 found on the HP support site.
        This driver allowed direct printing to the HP printer with the ZBWIPPQR device type. So it could be possible with other HP printers, check if the HP printer supports postscript on the config page, most likely there will be a postscript driver (probably :).

        (0) 
  2. Sergio Ferrari
    Thanks for this blog Robert, I would invite you to create a wiki section about mobile tagging and I’ll be happy to contribute with you.
    At TechEd 2010 in Berlin I hosted session “CD119 Introducing QR-Codes in Your SAP System” http://www.sapteched.com/emea/edu_sessions/session.htm?id=925 (promoted also here SAP TechEd 2010 – CD119 Introducing QR Codes in Your SAP System).
    I created the open Source Project abap2qrcode (https://code.google.com/p/abap2qrcode/) that I would like to consolidate into the wiki area in SDN.
    This is really an hot topic, let’s cooperate…
    Sergio
    (0) 
    1. Robert Russell Post author
      Hello Sergio,
      Thank you for your comment and additional information. I would be keen to contribute and cooperate on this. I have no permissions to create wiki pages, but I can add a page to the stage area and see where that takes me.
      Best Regards,
      Robert
      (0) 
  3. Oscar Wijaya
    Hi Robbert i want to ask you regarding smartforms that i built with include printer-control.
    when i print, it will show text+barcode instead of barcode only. is there any setting that i need to check?
    (0) 
    1. Robert Russell Post author
      Hello Oscar,
      It depends on your exact setup. So I suggest you check out the raw format of the spool request.

      In SP01 when viewing your output requests, select on the menu screen, ‘Goto’ –> ‘Display Requests’ –> ‘Settings’, and select RAW format. and search for ZBW01 and ZBW02. As you get the barcode then I guess ZBW01 will not show up. For testing purposes swap out the device type and print controls for SAP standard and see if they appear.

      Check out my business card for my email address, I am happy to help further via email.

      Cheers
      Robert

      (0) 
      1. Oscar Wijaya
        Hi Robert,

        thanks for your reply, i have checked SP01 and i cant find ZBW01 but i find ZBW02. is it correct?
        i already sent you details through email.

        (0) 
        1. Robert Russell Post author
          Hello Oscar,

          I didn’t receive any email with further info. However I am going to detail the following as a possible solution. Someone else contacted me via email before with a similar issue with smartforms. It makes sense to list it in the blog comments, even if it turns out not to be the exact cause of the missing print control you are experiencing. The work around/fix was as follows.
          In the smartform the setup was as below and did not create a proper barcode.
          LOOP
          ..
          .CELL
          ..PRINT CONTROL ZBW01
          ..TEXT FOR BARCODE
          ..PRINT CONTROL ZBW02

          Turns out the missing print control occurs even with SAP standard print controls so is a smartform issue/feature and not related to the device type.

          So the fix

          Change to
          LOOP
          ..
          .CELL
          ..TEXT – empty / or blank lines to make room for the barcode
          ..PRINT CONTROL ZBW01
          ..TEXT FOR BARCODE
          ..PRINT CONTROL ZBW02

          Best Regards
          Robert

          (0) 
          1. Alfredo Ledezma Meléndez
            Hello Robert,

            I’m facing the same situation as Oscar (the text+empty bar-code is showing instead of just the bar-code with the text between commands ZBW01 and ZBW02).

            Following your recommendation, I created an empty text element (3 empty lines), then the command ZBW01, the bar-code text and finally the command ZBW02, all of them included on a window, but the problem is still around.

            My scenario would be as follows:
            .WINDOW (QR_CODE)
            ..TEXT – 3 empty lines
            ..PRINT CONTROL ZBW01
            ..TEXT FOR BARCODE – The string “Hola”
            ..PRINT CONTROL ZBW02

            The raw spool request shows me the following:

            IN06QR_CODE
            4433555444422222222222222222222222222222222
            9E0612F3F4500000000000000000000000000000000
            PCZBW01
            5454533
            03A2701
            MT0028314674
            453333333333
            D40028314674
            CP11000000S
            45333333335
            30110000003
            FCHELVE   120  00100XSF005SF005110000067SX
            444445422233322333335543335433333333333355222
            6385C6500012000001008360053600511000006738000
            UL +0000000000000
            54223333333333333
            5C0B0000000000000
            SW00067
            5533333
            3700067
            CT00000000
            453333333322222222222222222222222222222222222222222222222222222222222222
            340000000000000000000000000000000000000000000000000000000000000000000000
            ST0065304HOLA
            5533333334444
            3400653048FC1
            PCZBW02
            5454533
            03A2702

            Thanks in advance for any help.

            (0) 
            1. Robert Russell Post author
              Hello Alfredo,
              From your description then we need to check the output at the postscript stage.
              Basically I think we need to go through  the “Identify the Text for the Barcode” part of the blog. A plain text frontend printer would be required (or other methods). Contact me via the email address on my business card and we can go through the process. Better via email than blog comments.
              Best Regards
              Robert
              (0) 
                1. Robert Russell Post author
                  Hello Alfredo,
                  I have detailed the fix we did to get the QRcode working on your system below.

                  Note I have changed the print controls in this comment because I am also going to change the device type available here.

                  More Barcodes with Barcode Writer in Pure Postscript

                  This way I can use print controls ZBW90 and ZBW91 in all the device types.

                  There is a section in the SDN blog about “Identify the Text for the Barcode” so if I print 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).

                  c) open smart.ps and search for “/s {bct exch ctxt” which is the start of print control ZBW01.

                  In your smartform 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 is not displayed correctly.

                  *NOTE, in the following example I will use postscript w1 and w2 as an example, the exact formatting may be different in your smartform, leave a comment and I will get back to you.

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

                  d) Modify the QRcode/barcode device type in transaction SPAD.
                  Add print controls

                  ADD TWO new print CONTROLS
                  ZBW90 = /w1 {bct} def
                  /w2 {ctxt /bct exch def} def

                  ZBW91 = /w1 {SW 0 8#040} def
                  /w2 {widthshow} def

                  e) 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.

                  f) Print the smartform to the original QRcode(barcode) printer.

                  The above can be found here with some screen shots.

                  http://www.rjruss.info/2011/10/sap-troubleshooting-qr-codes-in-smart.html

                  Any comments let me know happy to help.

                  Best Regards

                  Robert

                  (0) 
                  1. Alfredo Ledezma Meléndez
                    Dear Robert,

                    I apologize for the delay in updating the blog entry, but I was out of the office for a few days.

                    Your entire solution for printing barcodes is completely awesome, thanks for the great effort!

                    Regards, Alfredo

                    (0) 
                    1. Robert Russell Post author
                      Hello Alfredo,
                      no need to apologise, happy that you took time to comment and that we got the barcode working on your SAP system.
                      Cheers
                      Robert
                      (0) 
              1. Alfredo Ledezma Meléndez
                Thanks to Robert, the problem is solved in my smartform (SAP 4.6C); the main aspect of the solution is a fix to substitute the standard formatting (w1 and w2) included in the sapscript that overwrites /s command.

                The postscript generated originally included the following:

                /w1 {bct} def
                /w2 {ctxt /bct exch def} def
                14209 153 mt
                sapf5 sf
                67 sw
                w1 (This is some text that we want to turn into a barcode) w2
                bwippst
                bct sqrd
                bwippen

                Doing so, the output is the barcode text+an empty qrcode barcode.

                The solution is to implement 2 new print controls to allow concatenation of the text.

                ZBW10 = /w1 {bct} def \n/w2 {ctxt /bct exch def} def\n
                ZBW11 = /w1 {SW 0 8#040} def \n/w2 {widthshow} def \n

                Finally, we need to change the smartform in the following way:

                ..TEXT21
                ..COMMAND1 = ZBW10 –> changes w1 & w2
                ..TEXT20 –> This is the barcode text
                ..COMMAND2 = ZBW02 –> command to generate barcode
                ..COMMAND3 = ZBW11 –> resets w1 & w2

                And presto!

                (0) 
  4. Bhasker Rao
    I’m trying to print the MaxiCOde Barcode in the Smartform using the device type ZOPTRA which was created for the Lexmark Printer.

    In SPAD transaction the ZOPTRA device type has the printer controls SBP94(activate) and SBS94(deactivate) for the MaxiCOde Barcode Z_MAXI.

    In the Smartform, I have created a text element between 2 command nodes. The first command node is to switch on the barcode printing using the printer control SBP94
    and the Second command node is to switch off the barcode printing using the printer control SBS94.

    I tested the Smartform with PDF output using the ZOPTRA device type, it didnt create the MaxiCode Barcode for the tex element, but shows only the text.

    Could you please let me know if you have any idea about this issue? Also, let me know if you need more information.

    I really appriciate your help.

    Thanks,
    Bhasker

    (0) 
    1. Robert Russell Post author
      Hello Bhasker,

      I have no knowledge or experience of using Lexmark printers with SAP, so I can’t help with the ZOPTRA device types. Although generally state that you appear to be using the standard system barcode method with the lexmark. So I would guess that the physical printer will create the barcode and you will not be able to get a pdf with barcodes. Although I am not sure how you tried to create a PDF with the ZOPTRA device type. You could try the SCN forums, maybe someone can help you there.

      If you want to try this Barcode Writer in Pure Postscript method but with a MaxiCode barcode in a PDF. There is a MaxiCode device type for the BWIPP for SAP found here http://j.mp/sapmaxi
      Then the details in the blog can be used to generate a PDF with a MaxiCode barcode.
      Best Regards
      Robert

      (0) 
  5. Gabriele Mutti

    Hello Robert,

    is possible use the program RSTXPDFT4 for generate PDF file from spool create from ZBWIPP_M?

    When I print the barcode appears physically, but if once generated the spool RSTXPDFT4 convert to PDF with same does not appear.

    Can you help?

    (0) 
    1. Robert Russell

      Hi Gabriele,

      Apologies for the late reply, I have only just seen your comment.

      You will not be able to use the program RSTXPDFT4 as the process requires that OTF is converted into postscript and then PDF format.

      The postscript conversion is done by the device type you are using ZBWIPP_M and either printed directly on a postscript printer or converted to PDF by desktop software (e.g. cutepdf/pdfcreator)

      The program RSTXPDFT4 does not perform the OTF- postscript conversion that is required so that the BWIPP can generate the barcodes.

      If you do have any more questions happy to help out, when I see the message. As I have had to join SCN again with a new account, I do not get email updates to the blogs. (And also I am unable to edit this blog, so I can’t correct all the missing images and the messed up formats).

      Regards

      Robert

      (0) 
  6. Simone Cattozzi

    Great implementation!

    But I’m stucked trying to print control charaters as group separator, end of transmission and record separator. I’ve tryed many ways using different characters (\0x1d, /0x1D, /x1D, \u001D, {GS} ..) with no success.

    Did you have a solution?

    (0) 
    1. Robert Russell

      Hi Simone,

      Thanks for the comment and as to your question I would suggest you use the option parse with the Barcode Writer in Pure Postscript. The wiki page link is here  Input Processing · bwipp/postscriptbarcode Wiki · GitHub  which explains the format to use for unprintable characters. The device types I have created based on the the great open source Barcode Writer in Pure Postscript has the parse option as a print control ZOP01. I covered an option to use this with the carriage return & line feed options in this reply to my other blog.

      Barcodes in SAP with the Barcode Writer in Pure Postscript update

      So you would need to use the format ^NNN

      And I have googled the options for

      record seperator ^030

      group seperator ^029

      and

      End of transmission ^004

      Therefore use the ZOP01 print control with the above text where you need it as per the above comment and I would expect it would cover your requirements.

      Cheers

      Robert

      (0) 

Leave a Reply