Application Development and Automation 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: 
Read only

Get spool number using Job_Submit

Former Member
0 Likes
1,375

Hi,

I am calling Job_Submit inside a loop.Job_Submit executes a prg which creates 2- or more spools,thus inside a loop.

Job_Close for the corresponding job is outside the loop.

Is it poss to get the spool number(s) generated as a result of job execution inside the loop i.e. after Job_Submit and before job_Close.

I suppose spool number is generated after Job_Close.

Please assist!!!

Answers will be rewarded.

- Rohan

Hi,

I am calling Job_Submit inside a loop.Job_Submit executes a prg which creates 2- or more spools,thus inside a loop.

Job_Close for the corresponding job is outside the loop.

Is it poss to get the spool number(s) generated as a result of job execution inside the loop i.e. after Job_Submit and before job_Close.

I suppose spool number is generated after Job_Close.

Please assist!!!

Answers will be rewarded.

- Rohan

5 REPLIES 5
Read only

Former Member
0 Likes
1,021

Yes it is possible to get the spool number before JOB_CLOSE.

make use of below code snippet.

1) SELECT MAX( RQIDENT ) INTO G_SPOOL_NUM

FROM TSP01

WHERE RQCLIENT = SY-MANDT AND

RQOWNER = SY-UNAME.

Or else u can make use of system variable..........

2) SY-SPONO.

Reward if useful.....

Read only

marcelogb
Participant
0 Likes
1,021

2) SY-SPONO.

That's not working, it's empty

Spool number is stored on that system var (sy-spono) but it's cleared before going out of the submit so there's no data on it after.

Regards,

John

Edited by: John Smith on Nov 30, 2010 3:31 PM

Edited by: John Smith on Nov 30, 2010 3:43 PM

Read only

Former Member
0 Likes
1,021

Hi John,

If you are submitting the job, you will have the job name and the job number.

Within a DO-ENDDO use the function module 'BDL_READ_JOB_STATUS' passing it job name and job number (I believe the spool numbers are only assigned once the job is complete but I could be wrong here).

If the job status returned from 'BDL_READ_JOB_STATUS' = 'F' then the job is finished and exit the DO-ENDDO.

Select the SPOOLID from table TBTC_SPOOLID based on your job name and job number.

This should return all the spools you require.

Hope this helps.

Kind Regards,

Richard.

Edited by: Richvdl on Nov 30, 2010 3:49 PM

Read only

marcelogb
Participant
0 Likes
1,021

Using the job number would be a great idea since you can differ them clearly between different executions.

But, what if you use just the submit without being in a job?

Thanks and regards,

John

Read only

Former Member
0 Likes
1,021

Hi John,

I'm not too sure on your requirements, so to answer the question is rather difficult. I suppose you could export spool numbers to memory and then import or use similar methods etc. I afraid don't have a clear-cut method besides the use of the JOB_OPEN/JOB_CLOSE approach.

Have a look at this thread as it will give you some other approaches...

Kind Regards,

Richard.