Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Job step with multiple spools - find spool numbers

Former Member
0 Kudos

I have a background job with multiple steps. One of these steps runs CATA (RCATSTAL). This program frequently creates multiple spool files, but only the last spool file created is stored in table TBTCP. Is there some way that I can retrieve all the spool files created for a job step?


Former Member
0 Kudos

Hi Robert,

TRy using the Sp01 transaction and display spools for the current date and the printer name at which all the spools have printed in background. Alternatively if the spool has no printer assigned you can search by the user name who created the request or by title assigned to the spool request. This information you can find in under print specifications in each job step.

Hope this helps.

Former Member
0 Kudos

I need to do this programmatically. I need a function or a table that contains the spool numbers for all spools created in the job step.

0 Kudos

Try using the function Module <b>SXMI_XBP_JOB_SPOOLLIST_READ</b> for fetching the spool list for the Job.

0 Kudos

It would be nice to know if such a function or table exists. Take a look at OSS Note 422136 which states:

"2. You can only store one spool request even if a step generates several spool requests during processing. The application is responsible for a "spool overview" in this case. <b>If a step generates several spool requests during processing, only one request can be stored.</b> In this case, the application report should issue the number with a message when writing a spool request so that it is then displayed in the job log."

I agree that some sort of table that contains ALL the spool numbers for a job step would be great! Until SAP decides to implement such a table (have they already??) then we are left to use logic such as that in my previous post.

Maybe some others have some better insight into this issue. Please post a reply if so...


James Gaddis

0 Kudos

Also take a look at OSS Note 519059 which further supports the case that you must capture the individual spool numbers as they are being created (i.e. within the job step's program). The note contains the following:

8] Question: How are the spool requests assigned?

Answer: <b>The step information is stored in table TBTCP. This has space for exactly one spool request (field LISTIDENT). </b> <b>If a step generates several spool requests during the processing, only one can be stored. In this case the application is responsible for a "spool overview".</b>


James Gaddis

Former Member
0 Kudos

One thing I have done in the past is to send the individual spool numbers to the background job log. This allows the user to at least have a record of which spool numbers were created. This works great when you are talking about a non-SAP standard program. In your case, however, some creative maneuvering is required.

In order to accomplish this with RCATSCAL, you may need to write your own program that will submit RCATSCAL and then get parameter id 'SPI' to retrieve the spool number. I assume that the multiple spool files are the result of multiple "Target Components" being selected for one run. Your new program could be called in multiple background job steps (one per Target Component).

Of course, this may not be as efficient since all of the calls to function 'CATS_TRANSFER_HR' are being done in END-OF-SELECTION after reading the logical database information once.

Here is an example of the logic your new program might use:

    data: rep_spono    LIKE sy-spono,
          w_arc_params LIKE arc_params,
          w_pri_params LIKE pri_params,
    SUBMIT rcatscal AND RETURN
         SPOOL PARAMETERS w_pri_params
         ARCHIVE PARAMETERS w_arc_params
            WITH ...
* Send spool number to job log
    IF sy-batch = 'X'.
      GET PARAMETER ID 'SPI' FIELD rep_spono.
      MESSAGE s511(f0) WITH 'RCATSCAL' rep_spono.

You could even get a bit more fancy by saving the spool numbers for processing outside of the job log. e.g. Your saved spool numbers could be integrated with the SAP spool display functions in your own custom ALV report or the like.

The ideal location for the "get parameter id 'SPI' and spool number message" logic is in function CATS_TRANSFER_HR (after each of the SUBMIT RPTEXTPT statements), but this would probably require sending a development request to SAP (not likely to be added).

Good luck!

Best Regards,

James Gaddis

Active Contributor
0 Kudos

I got same problem, found this thread when analyzing.

We solved the problem by breaking RCATSTAL and using TCATSTCO, ZCAT7ENQ (note 568467), RCATSTPM, etc.