Skip to Content

Set username by variable in printer device type

Hello experts,

I'm struggling with the following problem at the moment:

we print out of SAP without any problems. Now we would like to send printouts to a queue server. To release the printouts at the printer itself, the person who printed has to go to the printer and identify by his company ID-Card. Then the printout is sent from queue server to the printer the person stands.

Sending spool request to the queue server is working fine. But to identify the person who has printed there sould be a field like "user" in the print request.

To realise this, I tried to edit the device type as described here: https://scn.sap.com/thread/1834105

That looks as follows on my system in the printer initialization:

#enter PJL mode and switch to PCL language
\e%-12345X@PJL\r\n
@PJL COMMENT User="$(User)" \r\n
@PJL ENTER LANGUAGE=PCL\r\n
#reset
\eE
#LaserJet Series II ECMA-94 Latin 1 character set
# disable perforation skip m ode
\e&10L
# SAPWIN data stream
\e%SAPWIN%
\i<*:*:XPAGES>
\i<*:*:XPGINIT>
\i<*:*:XPARAM>
\i<*:*:XLINEMOD>
\i<*:*:XFONT>

The relevant line is line no. 3 "@PJL COMMENT User ="$(User)" \r\n". The variable "User" is created and can be seen also on the print order on print server and queue server. But it is alway empty. I also tried to use "$(BENUTZER)" instead of "$(USER)", but this also didn't worked.

But if I set for example my user instead of this variable it works fine. So, I assume, varible $(BENUTZER)/$(USER) does not exist on our SAP system or is not read out.

Is anyone there who can help me with this issue? Any ideas?

Thank you very much in advance.

Florian

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 20, 2016 at 01:32 PM

    Hello Florian,

    I think in your case is the PJL command not correct. Could you please try

    the command

    \e%-12345X@PJL\r\n

    @PJL COMMENT User=$(User) \r\n

    @PJL ENTER LANGUAGE=PCL\r\n

    and see whether it works, or maybe also try

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

    Best regards,

    Norbert

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 29 at 03:03 PM

    Not, really it will works using:

    @PJL SET USERNAME= "$(User)" \r\n

    Or for Canon printers:

    @PJL COMMENT CANPJL SET USERNAME= "$(User)" \r\n

    Here Spool file resolved "$(User)" as "AX2CFEVE"

    Add comment
    10|10000 characters needed characters exceeded