Application Development 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: 

Batch jobs

Former Member
0 Kudos
148

Hello folks,

I am developing a program which runs every 15 min and create 150 batch jobs.

I need to know whether there is a FM or table or any other way to find out how many batch jobs are still running (created by my program)before next cycle of my program execution.

I need this because I have a restriction on the max no of jobs my program can create ata given time.

To be more clear, lets think my program created 150 batch jobs in the first run.

My program will run again after 15 min to create again 150 jobs. Lets suppose only 90 jobs which are created during the 1st run are finished then I can create only 90 jobs during the 2nd run because I can schedule 150 batch jobs only at a given time.

So I need a way to find out how many batch jobs are still running or finished.

Hope I made my requirement clear. Need more info please let me know.

Thanks

1 ACCEPTED SOLUTION

Former Member
0 Kudos
114

Hi Naren,

You can use the function module SHOW_JOBSTATE. You can get the values to pass to this using this select.


  select jobname jobcount from tbtco
    into (v_jobname,v_jobid)
   where jobname = v_billing_job_name
     and sdldate = prundt.
    CALL FUNCTION 'SHOW_JOBSTATE'
      EXPORTING
        JOBCOUNT              = v_jobid
        JOBNAME               = v_jobname
     IMPORTING
       ABORTED                = v_aborted
       FINISHED               = v_finished
*       PRELIMINARY            = v_preliminary
*       READY                  = v_ready
*       RUNNING                = v_running
*       SCHEDULED              = v_scheduled
*     EXCEPTIONS
*       JOBCOUNT_MISSING       = 1
*       JOBNAME_MISSING        = 2
*       JOB_NOTEX              = 3
*       OTHERS                 = 4

  endselect.

I added some more comments to your previous post. Please have a look at that.

Srinivas

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
114

How many "background" processes to you have in your system?

Regards,

Rich Heilman

0 Kudos
114

I'm thinking that you would have to use table TBTCO to check the status of your jobs.

Specifically, check the STATUS field of this table, if "F", then the job is finished, if "R", then job is running.

Regards,

Rich Heilman

0 Kudos
114

Rich,

I am assuming that there are 4 servers with 10 background processes each. Am I missing something??

Thanks,

Naren

0 Kudos
114

Just curious.....about the number of processes. About how long to these jobs(150) run.

Regard,

Rich Heilman

Former Member
0 Kudos
114

You can use the function BP_JOB_SELECT, this function return the jobs you have selected (It's functions used by SM37).

Max

Message was edited by: max bianchi

Former Member
0 Kudos
115

Hi Naren,

You can use the function module SHOW_JOBSTATE. You can get the values to pass to this using this select.


  select jobname jobcount from tbtco
    into (v_jobname,v_jobid)
   where jobname = v_billing_job_name
     and sdldate = prundt.
    CALL FUNCTION 'SHOW_JOBSTATE'
      EXPORTING
        JOBCOUNT              = v_jobid
        JOBNAME               = v_jobname
     IMPORTING
       ABORTED                = v_aborted
       FINISHED               = v_finished
*       PRELIMINARY            = v_preliminary
*       READY                  = v_ready
*       RUNNING                = v_running
*       SCHEDULED              = v_scheduled
*     EXCEPTIONS
*       JOBCOUNT_MISSING       = 1
*       JOBNAME_MISSING        = 2
*       JOB_NOTEX              = 3
*       OTHERS                 = 4

  endselect.

I added some more comments to your previous post. Please have a look at that.

Srinivas