The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Monday, 29 July 2013

Printing Bar Codes with SQR


Sometimes the life of a clerk is made easy by making a barcode available into your reports. For instance you can think of invoices sent to customers or expense report receipts collected from your employees having barcode enabled. This allows you to easily attach a physical document with an electronic document residing inside your system.

You can have this feature in PeopleSoft with the help of SQR programs. Typical implementation of a barcode to one of your reports is an easy task provided you already know the barcode standard that need to be used. The function print-bar-code in SQR prints a barcode of your specified type and data.  SQR supports 15 different types of barcodes. The supported types are


Value
Type
Text Length
1
UPC-A
11, 13, or 16
2
UPC-E
11, 13, or 16
3
EAN/JAN-13
12, 14, or 17
4
EAN/JAN-8
7, 9, or 12
5
3 of 9 (Code 39)
1 to 30
6
Extended 3 of 9
1 to 30
7
Interleaved 2 of 5
2 to 30
8
Code 128
1 to 30
9
Codabar
1 to 30
10
Zip+4 Postnet
5, 9, or 11
11
MSI Plessey
1 to 30
12
Code 93
1 to 30
13
Extended 93
1 to 30
14
UCC-128
19
15
HIBC
1 to 30


The barcode generation syntax is made as simple as possible.  You can take a look at the syntax provided below. For more details on barcode generation and other SQR functions, you may refer the PeopleBooks on that topic.

PRINT-BAR-CODE position
{TYPE={bar_code_type_num_lit|_var|_col}}
{HEIGHT={bar_code_height_num_lit|_var|_col}}
{TEXT={bar_code_txt_lit|_var|_col}}
[CAPTION={bar_code_caption_txt_lit|_var|_col}]
[CHECKSUM={checksum_lit}]

The TYPE will take a value listed in the table above which will create an appropriate barcode. The HEIGHT parameter will set the height of the barcode printed. If you are trying to print a barcode for an expense report in the system, then the unique id or the expense report id should be set to the property TEXT. CAPTION is an optional property, if you want the expense report id to be printed along with the barcode, then you may use this property. I advice to use this always to be in a safer position, if by mistake your barcode reader fails or if the image is faded, then you can easily identify the transaction in database with the caption text. CHECKSUM property takes a Yes or No value to compute and print the checksum.

I have mentioned about the usage in an expense report, let us see how the code will look like for this use case.

begin-program
   print 'Nicoles Expense Report’ (1,1)
   print-bar-code (3,1)
      type=1                                              ! Type = UPC-A
      height=0.3                                      ! Sets the height
      text=’ER345’                                  ! Unique id to distinguish the expense report
      caption=’ER345 Nicole USA’       ! Meaningful information to identify the database transaction manually

end-program


2 comments:

  1. Hi,

    Thanks for providing detailed explanation on how to print barcodes through SQR.

    We are on PeopleTools 8.52 and PS 9.1 application version. We have a requirement where we need to display the "Item UPN value" in a barcode format on the peoplesoft web page.

    User will click on 'generate my barcode' from PeopleSoft online page for item value, then barcode should be generated based on UPN value. User will then take the print of that barcode and use for some labelling purpose.

    Can you please provide the necessary steps on how we can achieve this?

    Thanks,
    Narry

    ReplyDelete
    Replies
    1. Hi Narry,

      If the intention of your business application is to generate a bar code that can be printed for labeling purpose, then you can extend the concepts described for SQR. First you need to create a SQR which prints barcode (check the post to see how) for the UPN value entered (UPN Value should be one of your run control parameter).
      Now the trick is you need to have REN server configured. If it is already configured then you are safe to proceed to next step. On the online page whenever user enters the UPN value and hits the “Generate” button, run the SQR report with ‘Run to Window’ option. The report output will be automatically opened in a new window (with the REN server configuration), which the user can directly take a print out.

      -PeopleSoft Journal

      Delete

Followers