Print Background Job’s Spool to the File System as a TEXT File

If you want to save your background job’s spool output to the file system as a text file or you want to print any SAP screen to the file system as a text file also then you can check the following steps…

First you have to create a SAP printer like below ;

SPAD –> Switch to Change Mode –> Create

ZPRINTFILE

Choose ;

- Device Type : “ASCIIPRI : Some generic ASCII printer”

Print Background Job's Spool to the File System as a TEXT File

- Host Spool Access method : “L : Print Locally Using LP/LPR”

Print Background Job's Spool to the File System as a TEXT File

Edit –> Command Set

You will see a new “Box” and write “A” character to the “Command Set ID”

Now new box will apper and you have to input datas like below ;

Description : Print to File

Command to transfer print data : Commands of operation

For our example ;

\\o\sapmnt\o\DVEBMGS00\spool\print.cmd &F \\o\sapmnt\o\DVEBMGS00\spool\

It means that  , execute the “print.cmd” and copy the file (&F) to location under “\\o\sapmnt\o\DVEBMGS00\spool\”

PRINT.CMD

@echo off
rem %1 file name
set target=F:\usr\SAP\O\DVEBMGS00\spool
REM copy file
cmd /c copy %1 %target% >> error.log

Command to query job status : echo OK

Print Background Job's Spool to the File System as a TEXT File

Now let’s try ;

For example screen SCC4

SCC4 –> Ctrl+P Print –> Select Output Device : ZPRINTFILE and print IMMEDIATELY

Print Background Job's Spool to the File System as a TEXT File

Now check the file system ;

Print Background Job's Spool to the File System as a TEXT File

Printout created as a text file on the OS

So you can use this printer for your background job’s spool outputs also…

 

 

7 Responses to "Print Background Job’s Spool to the File System as a TEXT File"

  1. khoe says:

    This really solved my problem, thank you!

  2. Paul says:

    This is very close to solving an issue with scheduled background jobs we have which are generating as .txt files. How would you adjust print.cmd so the generated filename could contain more than the spool number? For instance some additional characters identifying the specific spool request name or title which are in the overview tab of the Spool Request Attributes in Background Print Parameters (T-code SQ01).

    Regards,

  3. Chai Wing says:

    Keep on writing, great job!

  4. Prad33p says:

    Hi

    Its Good one

    Do we have the same command for UNIX based applications?
    i am struggling to find a command for the same

  5. SAP Admin says:

    I was also looking for same config for UNIX and finally configured it myself.

    Sharing it here so it can be helpful to someone.

    As shown above, when you double click on “Command Set ID” A , you 3 fields
    1. Description
    2. Command for Passing Print Data
    3. Command for Querying Job Statuses

    We have RHEL 8.2 Linux server, this is what my 2nd field value look like

    bash /usr/sap/AS4/D00/spool/print.sh &F /usr/sap/AS4/D00/spool/

    Once you save the device, go to Linux level

    1. Create “spool” directory inside /usr/sap/AS4/D00/
    2. cd /usr/sap/AS4/D00/spool
    3. touch print.sh
    4. chmod +x print.sh
    5. Paste Below contents inside your print.sh

    #!/bin/bash
    target=”/usr/sap/AS4/D00/spool/”
    @echo off
    echo “file name : ” $1 >> error.log
    echo “Copying file.” >> error.log
    cp $1 $target >> error.log

    6. Save the print.sh

    Test your print from ABAP, Choose new Device.

    I also chose the option “Immediate” instead of Spool.

    Thanks
    SAP Admin

Leave a Reply to sapbasisinfo


6 + = thirteen

Blogroll