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

Create spool for background jobs which uses submit statement

Former Member
0 Likes
10,499

Hi Gurus,

I have a quick question regarding the backgroud jobs. When we run a program in the background , it should create a spool for us, but, the problem comes when I am running a program in the background, its not creating the spool. This program uses SUBMIT statement. This program collects the data and it will submit to the other program and then retuen. In this case, its not creating a spool. Its very important for us to look at the spool for this program. Does anybody cam across this kind of problem? I need ur inputs.

Thanks in advance, <REMOVED BY MODERATOR>

Regards,

Srinivas.

Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:31 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,243

try replacing that submit statement with the submit statement having TO SAP-SPOOL spool_options .

Once that spool is generated you can track it from table tsp01.

G@urav

Hi Gurus,

I have a quick question regarding the backgroud jobs. When we run a program in the background , it should create a spool for us, but, the problem comes when I am running a program in the background, its not creating the spool. This program uses SUBMIT statement. This program collects the data and it will submit to the other program and then retuen. In this case, its not creating a spool. Its very important for us to look at the spool for this program. Does anybody cam across this kind of problem? I need ur inputs.

Thanks in advance, <REMOVED BY MODERATOR>

Regards,

Srinivas.

Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:31 PM

6 REPLIES 6
Read only

Former Member
0 Likes
5,243

hi check this link ...

Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.

DATA: number TYPE tbtcjob-jobcount,

name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

print_parameters TYPE pri_params.

...

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = name

IMPORTING

jobcount = number

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc = 0.

SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

WITHOUT SPOOL DYNPRO

VIA JOB name NUMBER number

AND RETURN.

IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = number

jobname = name

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

OTHERS = 8.

IF sy-subrc <> 0.

...

ENDIF.

ENDIF.

ENDIF.

https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=backgroundsubmit&adv=false&sortby=cm_rnd_rankvalue

sy-subrc Meaning

0 Background task scheduled successfully.

4 Scheduling cancelled by user on the selection screen.

8 Error during scheduling, i.e. when accessing JOB_SUBMIT internally.

12 Error in internal number assignment.

regards,

venkat.

Edited by: venkat appikonda on Mar 18, 2008 6:32 PM

Read only

0 Likes
5,243

Hi,

Thanks for ur quick reply. Do I need to write these job_open, submit and job_close in my program? Actually in my system, there is a job stream.

Fo example:

Jobstream 1:

Job 1 - This has the program with the submit statement.

job 2 - will read the file from job 1's output.

job 3 -

job 4 -

The above jobs are already set up in the system and it runs every day at scheduled time and we need the spool from job1 to see which documents are processed. The main program to which we are submitting from our program will have this information in the output screen. when I ran my program in the foreground, I can see the output, but only the problem is when I am running in the background.

Can you please let me know this. Thanks in advance.

Regards,

Srinivas.

Edited by: srinivas kari on Mar 18, 2008 6:50 PM

Read only

Former Member
0 Likes
5,244

try replacing that submit statement with the submit statement having TO SAP-SPOOL spool_options .

Once that spool is generated you can track it from table tsp01.

G@urav

Read only

Former Member
0 Likes
5,243

hi

did ur using the alvs if yes then please donot wrote the write statements ...it may cause the error..

check these links..

regards,

venkat.

Read only

0 Likes
5,243

Hi,

We do not have the ALVs and its plain output screen with the wrte statements and the jobs are already been set up and they will run at the scheduled intervals. Do I need to write the above statements in my program.

Thanks in advance,

Srinivas

Read only

Former Member
0 Likes
5,243

The issue is resolved. We used the "Exporting list to memory" in the submit statement and then we read this list and it worked for us.

Thanks for your help guys.