SAP Printing – SAP username in spool data

  1. Home
  2. Knowledge Base
  3. How-to Guides
  4. SAP Printing – SAP username in spool data
  1. Home
  2. Knowledge Base
  3. User Management
  4. SAP Printing – SAP username in spool data

SAP Printing – SAP username in spool data

Jobs submitted to Windows queues by the SAPSprint.exe service are normally assigned the job owner username SYSTEM. The username specified as the job owner will match the username under which the SAPSprint service is running.

When the PDAgent captures the print job, it will authenticate the job as SYSTEM, which means it won’t be assigned to the end user. To assign SAP jobs to the correct user, we need to configure the following:

  • Change the LPD port the PDAgent listens on to avoid conflict with SAPSprint.exe
  • Check the user’s Login name and Secondary login name in Resource Manager. One of these fields must contain their SAP username.
  • Configure the PDAgent on the print server to extract the SAP username from the print job spool data and use it to override the job owner.
  • Configure the SAP system to include the SAP username in the PJL headers of the spool data.

Avoid port conflict with SAPSprint.exe

By default, the SAPSprint service will use TCP port 515. This will conflict with the PDAgent LPD port. It is possible to change the port that SAPSprint.exe uses, but if the expertise to change this isn’t available, we can change the PDAgent LPD port.

Open the print server PDAgent and go to the Print services tab. Change the LPD port to 58515 as shown below:

On Windows, it is not possible to manually create a print queue with a custom LPR port. However, the PDAgent is able to create LPR print queues using the custom port. This can be done using the Alter port setting on print queues or by creating and applying Queue deployments.

Ensure the SAP username is contained in the Login name or Secondary login name field of user records

In most cases, when printing from client PCs (Windows/Mac/Chromebook) to a Windows print server, the job is authenticated with a username that is different from the SAP username. This is because the identity management of these operating systems and networks are independent from the SAP identity management.

It is possible that the SAP usernames have specifically been configured to match the user’s network/PC account names. In this rare case, we don’t need to configure the user’s Secondary login name because jobs printed from their PCs or SAP will be authenticated with the same username.

The example below shows the more common case where the user’s PC account name is different from their SAP username. Their domain account name is JohnDoe so that appears in the Login name field:

However, their SAP username is john_doe. This needs to be entered into their Secondary login name field on the Auth & Importing tab:

Now, whether they print from an app on their PC or from SAP, they will be able to release their job using their PIN (or card swipe).

Override the job owner with SAP username in spool data

We will create an override that will search for the SAP username in the following format of the print job data: @PJL COMMENT SAP_USER=”john_doe”

Open the print server PDAgent, click the Print services tab, then click the Extract job owner username from job button.

There will be some pre-defined overrides that are available. Tick the item with the Description: SAP user in spool data with @PJL SET COMMENT SAP_USER = ” prefix and ” suffix with spaces or no spaces either side of the equals sign.

This item will use a regular expression to search spool data. It will only search jobs that arrive with the job owner SYSTEM. This reduces unnecessary load on the server by ignoring all other jobs. If you double click the item, the settings can be customized. For example, if the SAPSprint.exe service doesn’t run under the SYSTEM account and uses a Service account (e.g. svc_sapsprint) then the job owner limitation must be changed to svc_sapsprint.

Configure the SAP system to include the SAP username in the PJL headers of the spool data

The following steps will need to be executed by the SAP system administrator.

  1. Log in to your SAP system with appropriate authorization (e.g. authorization for transaction code SPAD).
  2. Enter transaction code SPAD in the command field and press Enter to open the Spool Administration screen.
  3. On the Spool Administration screen, click the “Full Administration” button.
  4. Navigate to the “Device Types” tab.
  5. Find the device type that you want to modify or create a new one by clicking the “Create” button. If you choose to create a new one, provide a name and description, and choose the base device type to copy from.
  6. Click the “Print Controls” tab.
  7. Click the “Change” button to edit the print controls.
  8. Look for a print control sequence that corresponds to the PJL header (e.g., %X_START_PJL). If you can’t find an appropriate one, you can create a new print control sequence by clicking the “New Entries” button.
  9. Modify the existing print control sequence or create a new one to include the SAP username using the “@PJL COMMENT SAP_USER” format. To do this, add the following line to the print control sequence: @PJL COMMENT SAP_USER=”&SAP_USER”
  10. Save your changes.
  11. If you created a new device type or modified an existing one, make sure to assign it to the relevant output device(s) by navigating to the “Output Devices” tab and editing the output device’s properties.

Now, test sending a SAP print job and ensure it is assigned to the correct user based on the SAP username.

Document revision date: 2023/05/10
Software version: 2.4.2.0

Article Attachments

Related Articles