05-04-2009 2:27 AM
Gurus,
I am not sure if this post need to be in this group or not, can any one please help me.
I am running a job "ABC" which have couple of steps, this job normally finishes in 10 min, some times it may take 20 mins, some times even more.... Right now I have this job schedule to run every 10 min. Now the problem I have is when the job takes long time to finish I am having multiple jobs (same job) running parallely
Is there a way that I can schdule this job to run 10 min after each run (finish/cancel)?
Thanks in advance
05-04-2009 3:38 AM
Hi,
Why not add the code at the end of your current program to create a new background job by itself?
Try this codes below:
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.
Regards,
Lim...
05-04-2009 6:12 AM
While schelduling the job via SM36 , you can give this condition "After job" -> gove job name in this.
05-04-2009 6:13 AM
Let me clarify with you whether what I have understood from your query is correct or not.
1) You have a job which is scheduled to run 10 mins.
2) You want another instance of the same job to run after this job finishes up.
3) Sometimes this job might take more time to finsh off but, you dont want to release the next job unless this is finished.
If this is the scenario, do one thing.
As you have two steps in the job. try to add one more step as the first step.
This first step checks whether the previous instance of with the same job name is active or not.
If it is active cancel the job without executing the second and third step. This way you can achieve the maximum throughput
Hope you got it. Please let me know if you have any other queries.
Thanks,
Babu Kilari