cancel
Showing results for 
Search instead for 
Did you mean: 

Back ground JOB

Former Member
0 Kudos

Hi,

We have one Z program we have scheduled ever one hour in background, the problem is that the job is not getting finished with in one houru2019s time the same time next job getting active for the same program, because of that we when the job has got finished we are sending the repeated data from the SAP system.

Is there any provision that if the first job is not getting finished the next job should not get active so that we will not get the repeated data.

In the transaction code SM36 we have one option that release after job, even we have checked the same but it is not working..

Thanks & Regards,

Murali.M

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

As suggeted above there are a few ways of doing this.

My Way:

  1. Create the program ZCHECK_PREVIOUS_JOB (code below).
  2. Create a job. Step 1 will have program ZCHECK_PREVIOUS_JOB and step 2 contains the periodic program. Be careful to give your job a unique name.

*&---------------------------------------------------------------------*
*& Report  ZCHECK_PREVIOUS_JOB_RUNNING
*&
*&---------------------------------------------------------------------*
*&
*& To be used in jobs as step 1

*&---------------------------------------------------------------------*

REPORT  zcheck_previous_job_running.

DATA: gv_count TYPE i,
      gv_jobname LIKE tbtcm-jobname.

CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
  IMPORTING
    jobname                 = gv_jobname
  EXCEPTIONS
    no_runtime_info         = 1
    OTHERS                  = 2.

* Check that this is the only job with whis name.
SELECT COUNT(*)
        into gv_count
        FROM tbtco
      WHERE jobname = gv_jobname
        AND status = 'R' GROUP BY status.
ENDSELECT.

CHECK gv_count GT 1.
* Issue error to stop this job.
MESSAGE e008(csm).
*   Job terminated because identical type job already exists

Former Member
0 Kudos

Sorry for my typo mistake.

http://wiki.sdn.sap.com/wiki/display/Basis/Howtorunconsequentorchainedbackground+jobs

Regarrds,

Nick Loy

Former Member
0 Kudos

Go through below link

[http://wiki.sdn.sap.com/wiki/display/Basis/Howtorunconsequentorchainedbackground+jobs|How to run consequent and chained jobs in SAP]

Regards,

Nick Loy

Former Member
0 Kudos

Hello Murli,

I can suggest you two ways

1. AFter Job

you can use same job name in after job name filed

First job schedule manually then next job will run automatically after first job completion.

2. After Event

As this is your customized program you can ask developer to call zevent at the end of the program. You can create event using SM62

and mentioned Event name in the scheduling SM36 after event filed

Regards,

Nitin Salunkhe

Former Member
0 Kudos

Hi,

In the transaction code SM36 we have one option that release after job

It means that the job will be release only if the another job is release...

It doesn't mean that the job will be release only if the another job is FINISHED...

for this you need to configure SUCCESSOR JOB for your background job.

You can schedule the job using JOB WIZARD...

where you can select option "After Job" on one of the screen and on the next screen, give the JOB Name <JOB NAME WHICH MUST BE FINISHED BEFORE STARTING THIS ONE> and select "Start if the Predecessor job ends successfully"...

Then your Job will be executed, only if the another job is completed successfully (as defined above)

Regards.

Rajesh Narkhede

Former Member
0 Kudos

Hi Rajesh,

I have tried the transaction code SM36WIZ there are so many steps needs to execute in this transaction.

can pls give me the more details by steps wise how to use for the same to our requirement..

Regrds,

Murali.M

former_member524429
Active Contributor
0 Kudos

This message was moderated.

former_member524429
Active Contributor
0 Kudos

Hi,

Please refer the following threads with the same requirement which you are looking for.

[|]

[|]

[http://www.abaplearning.com/abap-tutorials/data-interfaces/5-abap-data-interfaces/71-job-scheduling|http://www.abaplearning.com/abap-tutorials/data-interfaces/5-abap-data-interfaces/71-job-scheduling]

Regards,

Bhavik G. Shroff

Former Member
0 Kudos

Hi Murali,

You can go through the links given by BHAVIK for more details...

here are the steps in short to define such background jobs.

For example:

JOB-A : A normal background job

JOB-B : A job which should run only if JOB-A is finished.

Execute SM36WIZ t-code

1. Click Continue on "The job wizard" screen.\
2. Give "Job Name" (For example, JOB-B) and set the "Job Class" and "Target Server". Then click "Next".
3. Select Step. For example, "Abap program step".
4. Select ABAP program name, variant and Other option as needed. Then Click Next.
5. On Multi-step, click Next.
6. Select "After Job" and click Next.
7. On "Triggering the start of one job with the end of Another" Screen, you can specify "Job Name" *(For example, JOB-A)* 
    which must be finished before starting the current job. Select "Start if the predecessor job ends successfully". 
     Then Cllick "Continue".
8. On last screen, click on "Complete".

So JOB-B will run only if JOB-A is finished...

Hope, it will clear your all confusion...

Regards.

Rajesh Narkhede

Former Member
0 Kudos

Hi Rajesh,

By doing the job wizard (SM36WIZ) we can able to achieve the one job get finish automatically next job will get release.

But in our case we schedule the job at every one hour i think this will not work in our case.

kindly give us the any alternative solution.

Regards,

Murali.M

former_member524429
Active Contributor
0 Kudos

Hi,

As I told earlier, the following ways can be possible in ur case.

Option-1.

Schedule that Same Background Jobs with the Time gape of their Highest Run time.

e.g. Suppose, you know the average maximum run-time valuee.g. 1hrs & 15 Minutesfor all same Back ground Jobs of the same type, then you can schedule one single Back ground Job with time gape of every 1 Hrs and 20 Minutes (with some time margin) .

In this way you can avoid Background Job Bottleneck Problem in peak time & overlapping of the same Background Jobs in daily execution.

Option-2.

(this is not the recommended way to schedule a job...)

If you are sure about the Minimum and Maximum run time of such Background Job, then you can create 23 Same Background Jobs with 23 Different Background Job Names.

Then you can enforce dependency with the last successful dependent Background Job(as the same Background Job will have different Job Names)by using "After Job" option and "Start Status Dependent" Check Box enabled.

Only the first Background Job will run with Daily Frequency, and rest of the Background Jobs will run based on the completion of their dependent Jobs (predecessor Jobs) one by one.

Use the earlier suggested links for such scheduling.

I will recommend the option-1 for scheduling a Back Ground job in ur case.

Because, with option-2, upon failure of First Background Job , all successor Jobs will not be executed.

Regards,

Bhavik G. Shroff

former_member524429
Active Contributor
0 Kudos

Hi,

Proper Background Job Scheduling for the same kind of BJob (with some time gape) will be helpful in your case. Otherwise it can lead to non-availibility of all Background Process to perform other important Background jobs.

Please reschedule all consecutive same BJob with highest Bjob Run time to avoid Time overlapping and also to avoid resouce bottleneck..

Regards,

Bhavik G. Shroff