How to Configure a Print Device in SAP to Inject a Username into a PJL Header

How SAP Prints

SAP has two fundamentally different versions of print: front end and back end. SAPSPrint or front-end print is executed on the computer of the end user. Background printing is executed on the server. The following text is related to background printing.

SAP has a defined Device with Device Type. Each Device Type has a PRI file (something like a print driver). This file describes how the content should be generated.

The default version of the PRI file does not contain a PJL header with a username. It is necessary to update the driver and add a line there manually.

How to add a PJL header to the job

Step 1. (*voluntary) Choose an existing PRI file from SAP and back it up:

Invoke an SPAD transaction.

images/download/thumbnails/284926869/sap-spad-transaction-version-1-modificationdate-1541622281187-api-v2.jpg

Click the Utilities menu, select the For device types menu, click Export.

images/download/attachments/284926869/sap-spad-export-version-1-modificationdate-1541622281157-api-v2.jpg

Specify the device type, e.g., HPUTF8, and click the Execute (F8) icon.

images/download/attachments/284926869/sap-spad-device-type-export-version-1-modificationdate-1541622281123-api-v2.jpg

Step 2a. Copy an existing device type to a new device type with the prefix Z or Y (= an indication of customization),

images/download/attachments/284926869/image2018-9-25_14-46-35-version-1-modificationdate-1541622281067-api-v2.png

and click Execute (F8).

images/download/attachments/284926869/image2018-9-25_14-35-5-version-1-modificationdate-1541622280837-api-v2.png

Step 2b. Download the PRI file from the vendor site (e.g., https://support.hp.com/ee-en/document/c05051702).

and import the PRI file as a Device Type that begins with Z or Y.

images/download/attachments/284926869/image2018-9-25_14-47-8-version-1-modificationdate-1541622281097-api-v2.png

Step 3. Edit the custom Device Type.

Step 3.1. Go back to SPAD and select Full administration (F7).

images/download/attachments/284926869/image2018-9-25_14-39-3-version-1-modificationdate-1541622280860-api-v2.png

Step 3.2. Display a list of device types.

images/download/attachments/284926869/image2018-9-25_14-40-8-version-1-modificationdate-1541622280917-api-v2.png

Step 3.3. Choose the custom device type (with that prefix Z or Y) and display List of implemented formats (F6).

images/download/attachments/284926869/image2018-9-25_14-43-12-version-1-modificationdate-1541622280980-api-v2.png

Step 3.4. Choose the desired format type(s) or create a new one.

images/download/attachments/284926869/image2018-9-25_13-57-13-version-1-modificationdate-1541622280687-api-v2.png

Step 3.5. Click Change and edit Printer initialization.

images/download/attachments/284926869/image2018-9-25_14-45-6-version-1-modificationdate-1541622281030-api-v2.png

Step 3.6a. Add the following line if you want the username to contain the SAP name of the user who created the output request.

@PJL USER=$(USER)\r\n

images/download/attachments/284926869/image2018-11-2_12-53-18-version-1-modificationdate-1541622280517-api-v2.png

Step 3.6b. Add the following line if you want the username to contain the SAP name of the owner (probably, the same as user).

@PJL USER=$(OWNER)\r\n

images/download/attachments/284926869/image2018-11-2_12-52-29-version-1-modificationdate-1541622280490-api-v2.png

Step 3.6c. Add the following line if you want the username to contain the SAP name of the receiver of the output.

@PJL USER=$(RECEIVER)\r\n

images/download/attachments/284926869/image2018-11-2_12-51-7-version-1-modificationdate-1541622280443-api-v2.png

Step 3.7. Save the change.

Job name encoding

The default encoding in SAP is often Latin 2 or Windows-1252.

In the case of YSoft SafeQ 5, you need to set proper encoding in the Dispatcher Paragon option lprEncoding to decode users with logins that contains special characters like ä, ž, š.

In the case of Dispatcher Paragon up-to MU26, the option lprEncoding does not work and Dispatcher Paragon always assumes UTF-8. The solution is to switch to the UTF-8 driver in SAP, e.g., HPUTF8. Note: do not forget to add the PJL header described in the previous section.


Frequently asked questions

Question

Answer

Is this device created in SPAD seeable by all SAP users?

Unless configured otherwise.

How do you handle SAP user IDs that don't match the users AD account?

Use aliases for accounts in Dispatcher Paragon.

We want to parse the user from the job title in Dispatcher Paragon6, but it is not working. In Dispatcher Paragon5 we had no issue at all. What could be the cause?

The configuration option of Dispatcher Paragon "Location of username in jobtitle" - "parseUserFromTitleIndex" changed. In SQ5 the index begins with 1, in SQ6 it begins with 0. Change the option so it matches desired position in job title.

What is the difference between device type in SAP and a driver or is this the same?

A printer driver is an attribute of SAP device type. This document is related to server-side printing.

Do you need to make the change in all formats within the device type?

Yes, if you want to support all formats.

Which method is it possible to use? Is it Ζ: User-Defined Formatting Routine (Host Spool Access Method)?

The Z method is marked by SAP as deprecated. The example will work with U or E method.

How about the job names that are blank from some SAP prints? Is it SAP related?

You set job title at spool request creation (print parameter). It may also happen if you use username as job title and you enable parsing username from job title and deletion of parsed username from job title in Dispatcher Paragon Spooler settings.

When the print Jobs come from SAP direct to Printer. How Can I identify who user is send this printing?

This is vendor specific. Some vendors allows direct print, when Terminal is installed, the devices parses PJL header and asks Dispatcher Paragon whether it's possible to release the job. Then the Dispatcher Paragon is able to match the job even with direct print.

Is SAP administrator account needed in order to add a new print driver?

No. It is sufficient to have an account which has permission to work with SPAD transaction. E.g. DEVELOPER account has such permission.

Does the PJL header from SAP have to match then the syntax from the Windows driver?

Configuration option " Expression for username parsing from PJL job headers" should be configured so it matches both cases. E.g.: @PJL [SET]* USER[ ]*=[ ]*(.*)(@|\n|\r)