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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve multiple spool numbers of a job

former_member443015
Participant
0 Kudos

Hello All

My ABAP report program will produce several spool list. I would like to ask that are there any functions that I can retrieve ALL spool numbers of the job?

This is because I find that I cannot find the relationship between job and ALL its spool number.

Many thanks

Sunny

6 REPLIES 6

Former Member
0 Kudos

Hi,

Check table TSP01, It will store all the spool numbers...

Hope this helps you

Regards

Shiva

Former Member
0 Kudos

Check this,

Use Fm : BAPI_XBP_JOB_SPOOLLIST_READ to read from

spool

Regards,

Midhun Abraham

Former Member
0 Kudos

Hi,

I had a similar requirement to find all the spools created for a specific printer. Only one spool ID is ever stored against the job step.

I developed a bespoke program and included this within my background job (which had multiple steps). This finds the upper and lower spools for the current job ID.

The code to find the spools was as follows:

form get_spools .

*-----------------------------------------------------------------------
* Get the current job details
*-----------------------------------------------------------------------
  call function 'GET_JOB_RUNTIME_INFO'
    importing
      jobcount        = gs_btcinfo-jobcount
      jobname         = gs_btcinfo-jobname
      stepcount       = gs_btcinfo-stepcount
    exceptions
      no_runtime_info = 1
      others          = 2.
  check ( sy-subrc eq 0 ).
  write: / 'Job', gs_btcinfo-jobcount, gs_btcinfo-jobname.

*-----------------------------------------------------------------------
* Get the spools for the current job
*-----------------------------------------------------------------------
  select * into table gt_tbtcp
     from tbtcp
    where jobname   eq gs_btcinfo-jobname
      and jobcount  eq gs_btcinfo-jobcount
      and stepcount <> gs_btcinfo-stepcount
      and listident <> ''
      order by primary key.

  if ( gt_tbtcp is initial ).
    write: / 'No spools to print'.
    exit.
  endif.

*-----------------------------------------------------------------------
* Find the upper & lower spool ID's
*-----------------------------------------------------------------------
  clear: gv_low, gv_high.
  clear gs_tbtcp.
  read table gt_tbtcp into gs_tbtcp index 1.
  gv_low = gs_tbtcp-listident.

  describe table gt_tbtcp lines sy-tfill.
  clear gs_tbtcp.
  read table gt_tbtcp into gs_tbtcp index sy-tfill.
  gv_high = gs_tbtcp-listident.

  add p_low  to gv_low.
  add p_high to gv_high.

*-----------------------------------------------------------------------
* Read all the spools within the range
* This covers job steps that create multiple spools
*-----------------------------------------------------------------------
  select * into table gt_tsp01
    from tsp01
      where rqident ge gv_low
        and rqident le gv_high
        and rqdest  in s_dest
        and rqfinal in s_final.

endform.                    " get_spools

Regards,

Darren

0 Kudos

Hello,

Thanks your answer..

I have tried your method..but I find that in the table tbtcp, In only contain my last spool record of my job.

In my report which output multiple spools, here is some of the coding:

//Output List A

NEW-PAGE PRINT OFF.

NEW-PAGE

PRINT ON LINE-COUNT 70 LINE-SIZE 255

LIST NAME 'Report - Schedule A'

COVER TEXT 'Report - Schedule A'

IMMEDIATELY ' '

KEEP IN SPOOL 'X'

NEW LIST IDENTIFICATION 'X'

LIST DATASET 'LIST5S'

LAYOUT 'X_70_255'

SAP COVER PAGE SPACE

NO DIALOG.

.. .. .. .. ..

.. .. .. .. ..

.. .. .. .. ..

//Output List B

NEW-PAGE PRINT OFF.

NEW-PAGE

PRINT ON LINE-COUNT 70 LINE-SIZE 255

LIST NAME 'Report - Schedule B'

COVER TEXT 'Report - Schedule B'

IMMEDIATELY ' '

KEEP IN SPOOL 'X'

NEW LIST IDENTIFICATION 'X'

LIST DATASET 'LIST5S'

LAYOUT 'X_70_255'

SAP COVER PAGE SPACE

NO DIALOG.

.. .. .. .. ..

.. .. .. .. ..

.. .. .. .. ..

Do I need do some modifications on the above coding, so that all spools will exists in able tbtcp?

Many thanks

Former Member
0 Kudos

Hi

Good

Check the below SDN link, hope this will help you to solve your problem.

Thanks

mrutyun^

Former Member
0 Kudos

Hi,

visit this forum thread: