SAP Printing: SAP username in spool data
SAP Printing: SAP username in spool data
When SAP prints to a Windows print queue through the SAPSprint service, the jobs arrive with the user name the service runs as, normally SYSTEM. The PDAgent would then record them as SYSTEM, not the person who printed. To match SAP jobs to the right user:
- Stop the PDAgent’s LPD service clashing with SAPSprint.
- Make sure each user’s SAP user name is on their user record.
- Set the print server’s PDAgent to take the SAP user name from the job.
- Set up SAP to put the user name in the job.
Avoid a port clash with SAPSprint
SAPSprint uses TCP port 515, the same port as the PDAgent’s LPD service. If you cannot change the SAPSprint port, change the PDAgent’s:
- In Resource Manager, click PD Agents, and double-click the print server’s PDAgent.
- On the Print services tab, under IPP & LPD services, change the LPD Port to 58515.
- Click OK + Refresh.
Windows does not let you create a print queue with a custom LPR port by hand, but the PDAgent can: use the queue’s port setting in Print Queue Management, or a Queue Deployment.
Put the SAP user name on the user record
Usually a user’s SAP user name differs from their Windows account name, because the two are managed separately. For example, Windows JohnDoe is in Login name, but the SAP user name is john_doe:
- In User Management > Users, double-click the user.
- On the Advanced tab, enter the SAP user name in Secondary login name.
- Click OK.
Jobs from their computer and from SAP are then both matched to them, and they release both with the same PIN or card. (If SAP user names already match the Windows account names, skip this step.)
Take the SAP user name from the job
- In PD Agents, double-click the print server’s PDAgent, and click the Print services tab.
- Click Extract job owner username from job.
- Tick the ready-made item 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.
- Click OK, and OK + Refresh.
This item searches the print data for a line such as @PJL COMMENT SAP_USER=“john_doe”, and matches the name to a user. It only checks jobs whose owner is SYSTEM, so other jobs are not slowed down. If SAPSprint runs as a service account instead (for example svc_sapsprint), double-click the item and change the job owner it checks to that account.
Set up SAP to put the user name in the PJL header
Your SAP administrator does this, in the SAP GUI (the steps may differ slightly between SAP versions):
- Run transaction SPAD (Spool Administration), and click Full Administration.
- On the Device Types tab, find the device type to change, or click Create to make a new one based on an existing type.
- On the Print Controls tab, click Change.
- Find the print control for the PJL header (for example %X_START_PJL), or click New Entries to add one, and add this line: @PJL COMMENT SAP_USER=“&SAP_USER”
- Save. If you created or changed a device type, assign it to the output devices on the Output Devices tab.
Send a test job from SAP and check that it is recorded against the right user.
Related articles
| Document revision date: 2026/11/05 Software version: 2.5.15.3 |
