cancel
Showing results for 
Search instead for 
Did you mean: 

How to schedule a background job for several time Daily

Former Member
0 Kudos

Hello there,

I need to run an ABAP program as a scheduled job to run at 4 different times daily.

For example, I have program ABC that  I need to run daily at 9:15, 9:30, 10:15 & 11:30

Is there a way to achieve that other than creating multiple background jobs.

Regards

A.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ameen,

I explored a bit, but it is not possible to schedule one job at time as described by you. you will have to create multiple jobs.

Regards,

Dipesh

Former Member
0 Kudos

Hi Dipesh,

Thanks for exploring the possibilities.

Regards,

Ameen

Answers (4)

Answers (4)

Former Member
0 Kudos

This message was moderated.

jan-erik_lovlie2
Explorer
0 Kudos

Hello Ameen,

An external job scheduler is capable of running a job at 4 different times daily.

You can see a list of schedulers in:

http://ecohub.sap.com/software

then search for "job scheduler"

Former Member
0 Kudos

hi

you can make program like below using JOB_OPEN, SUBMIT, JOB_CLOSE

REPORT zaatest.

DATA: jobname             LIKE tbtcjob-jobname VALUE 'ZAA_PROG',

       jobcount            LIKE tbtcjob-jobcount,

       host                LIKE msxxlist-host,

       starttimeimmediate  LIKE btch0000-char1 VALUE 'X'.

TYPES: BEGIN OF ty_schedule,

         strtdt TYPE btcsdate,

         strttm TYPE btcstime,

         END OF ty_schedule.

DATA : it_schedule TYPE TABLE OF ty_schedule,

        wa_schedule TYPE ty_schedule.

wa_schedule-strtdt = '20121108'.

wa_schedule-strttm = '091500'.

APPEND wa_schedule TO it_schedule.

CLEAR : wa_schedule.

wa_schedule-strtdt = '20121108'.

wa_schedule-strttm = '093000'.

APPEND wa_schedule TO it_schedule.

CLEAR : wa_schedule.

wa_schedule-strtdt = '20121108'.

wa_schedule-strttm = '101500'.

APPEND wa_schedule TO it_schedule.

CLEAR : wa_schedule.

wa_schedule-strtdt = '20121108'.

wa_schedule-strttm = '103000'.

APPEND wa_schedule TO it_schedule.

CLEAR : wa_schedule.

LOOP AT it_schedule INTO wa_schedule.

* Job open

   CALL FUNCTION 'JOB_OPEN'

     EXPORTING

       delanfrep        = ' '

       jobgroup         = ' '

       jobname          = jobname

       sdlstrtdt        = sy-datum

       sdlstrttm        = sy-uzeit

     IMPORTING

       jobcount         = jobcount

     EXCEPTIONS

       cant_create_job  = 01

       invalid_job_data = 02

       jobname_missing  = 03.

   IF sy-subrc NE 0.

     "error processing

   ENDIF.

* Insert process into job

   SUBMIT zaa_prog AND RETURN

   USER sy-uname

   VIA JOB jobname

   NUMBER jobcount.

   IF sy-subrc > 0.

     "error processing

   ENDIF.

* Close job

   CALL FUNCTION 'JOB_CLOSE'

     EXPORTING

       jobcount                         = jobcount

       jobname                          = jobname

      sdlstrtdt                         = wa_schedule-strtdt

      sdlstrttm                         = wa_schedule-strttm

*   STRTIMMED                         = ' '

    EXCEPTIONS

      cant_start_immediate              = 1

      invalid_startdate                 = 2

      jobname_missing                   = 3

      job_close_failed                  = 4

      job_nosteps                       = 5

      job_notex                         = 6

      lock_failed                       = 7

      invalid_target                    = 8

      OTHERS                            = 9

             .

   CLEAR : wa_schedule-strtdt,

           wa_schedule-strttm.

ENDLOOP.

Former Member
0 Kudos

Thank you all for the time you spent trying to help.

Most appreciated.

I will have to go with multiple jobs. I am not at the level to use ABAP code yet.

Thanks again,

Ameen

Former Member
0 Kudos

Hi Ameen,

If you want to schedule a job for programe at frequency of 15 mins you can do that no need to create new jobs for same programe.

Go to SM36

In Start condition you can find the different options like imidiate , Date and Time , After job etc. I think Date and time will suit your requirement

In this screen there is option Perodic job. Just tick it and select perodic value and give the time interval in ur case 15 mins

Hope this resolves your issue.

Regards

Former Member
0 Kudos

Dear Ritz HCM,

Periodic jobs are defined to go beyond the periodic boundries of 1hr,1day,1week,1year,etc..If you set the periodic job with special period as 15 mins, then after every 15 minutes the job will run. It will not skip the period after the 4 jobs are done, as per Ameen's requirement.

Regards,

Dipesh