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

background job scheduling edit

Former Member
0 Likes
869

Hi

i have a program which executing as a background job for every 3 minuts. but some times the job which is in process is taking a long time like up to 5 minuts and as per job scheduling after 3 minuts of first scheduled job, it is starting another same job. like that sometimes it is going upto 4 to 5 same job is processing.

Is there any solution like : only one of that job should be in the job execution process . but once the job is running the same job should not start. but if it is completed with in 3 minuts the job should be start as scheduled.

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
816

HI all

thanks for reply, but my report program is the standard one for which i cannot modify or change. so where can i write the code for running next job. Is it anyway possible through the events.?

5 REPLIES 5
Read only

Former Member
0 Likes
816

Hi.

All the Jobs are saved in table TBTCP and TBTCO tables and so check with status in the table TBTCP with job name and status

if the status is 'S" that means it is completed then start the next Job.

Prabhudas

Read only

RaymondGiuseppi
Active Contributor
0 Likes
816

Try to lock an object (a database table E_TABLE or even a program EPROG) at the beginning of the job, if the object is already locked, exit, an other instance of the job is running.

Regards,

Raymond

Read only

Former Member
0 Likes
816

Hi,

I think there is a way in Job scheduling itself to define the next job only when the current one is complete (irrespective of how the execution takes place).

I recently recd help on this topic.. if you are triggering jobs from a program, you can add the foll code to make the second job (or further progm processing) to wait till the current job is over..

WHILE v_fin IS INITIAL.

CALL FUNCTION 'SHOW_JOBSTATE'

EXPORTING

jobcount = l_jobcount

jobname = l_jobname

IMPORTING

finished = v_fin

EXCEPTIONS

jobcount_missing = 1

jobname_missing = 2

job_notex = 3

OTHERS = 4.

IF sy-subrc <> 0.

ERROR_JOB = '1'.

v_fin = 'X'.

ENDIF.

ENDWHILE.

Hope this helps.. Regards, Liz

Read only

Former Member
0 Likes
817

HI all

thanks for reply, but my report program is the standard one for which i cannot modify or change. so where can i write the code for running next job. Is it anyway possible through the events.?

Read only

0 Likes
816

Just create a small driver report (with same parameters, or using a variant as parameter)

This report contains two part

- 1 - lock an object (any suitable table, report or record)

- 2a - if lock successful, submit standard report with parameters or variant

- 2b - if lock unsuccesful, exit (another/previous instance did not yet release the lock, send an information message which will be available in the job log)

If there are other jobs with the same problem, create a generic program with two parameters program and variant, use the program as lock object and use the same report in each of those job.

Regards,

Raymond