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: 

How to schedule job hourly on daily basis

Former Member
0 Kudos
2,742

Hi,

Experts.

I want to schedule a job between 9:00 AM to 9:00 PM daily on working days Monday to Friday IST.

It should run on hourly basis daily. Currently we are following the manual process for scheduling the jobs in SM36. We want to automate the process. Can SCMA help in this ?

How to achieve this, would like to have experts insights on the same.

Regards,

Edited by: Sharvari Joshi on Nov 23, 2010 7:36 PM

10 REPLIES 10

brad_bohn
Active Contributor
0 Kudos
745

Easily done via an event driven job with a job that triggers the event within the window. Last time I answered this question was about two weeks ago.

Former Member
0 Kudos
745

Hi,

Brad

Thanks for your quick reply. It will be great if you could provide me thread ID for which you answered, let's hope that it will get through me the issue.

Can you please suggest any workaround ?

Regards,

Sharvari Joshi.

Former Member
0 Kudos
745

Hi,

Any clues ?

Former Member
0 Kudos
745

Hi,

Read Job Start Conditions from below link

http://help.sap.com/saphelp_nw70/helpdata/EN/20/2d513897110872e10000009b38f889/content.htm

Regards,

Salil

Former Member
0 Kudos
745

Write an ABAP report program. with the below code stub.

Further you can check the function group BTCH for more options.

Customize the function call job close.

Hope this helps in automating.

CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      JOBNAME          = JOBNAME
      JOBCLASS         = 'C'
    IMPORTING
      JOBCOUNT         = JOBCOUNT
    EXCEPTIONS
      CANT_CREATE_JOB  = 01
      INVALID_JOB_DATA = 02
      JOBNAME_MISSING  = 03.
  IF SY-SUBRC NE 0.
    exit."error processing
  ENDIF.

  SUBMIT (JOBNAME)
  USER SY-UNAME
  VIA JOB JOBNAME
  NUMBER JOBCOUNT
  AND RETURN.

  IF SY-SUBRC = 0.
  ELSEIF SY-SUBRC = 4.
    RAISE SCHEDULING_CANCELLED_BY_USER.
  ELSEIF SY-SUBRC = 8.
    RAISE ERROR_DURING_SCHEDULING.
  ELSEIF SY-SUBRC = 12.
    RAISE ERROR_IN_INTERNAL_NUMBER_ASSIG.
  ENDIF.

CALL FUNCTION 'JOB_CLOSE'
  EXPORTING
*   AT_OPMODE                         = ' '
*   AT_OPMODE_PERIODIC                = ' '
*   CALENDAR_ID                       = ' '
*   EVENT_ID                          = ' '
*   EVENT_PARAM                       = ' '
*   EVENT_PERIODIC                    = ' '
    JOBCOUNT                          =
    JOBNAME                           =
*   LASTSTRTDT                        = NO_DATE
*   LASTSTRTTM                        = NO_TIME
*   PRDDAYS                           = 0
*   PRDHOURS                          = 0
*   PRDMINS                           = 0
*   PRDMONTHS                         = 0
*   PRDWEEKS                          = 0
*   PREDJOB_CHECKSTAT                 = ' '
*   PRED_JOBCOUNT                     = ' '
*   PRED_JOBNAME                      = ' '
*   SDLSTRTDT                         = NO_DATE
*   SDLSTRTTM                         = NO_TIME
*   STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
*   STRTIMMED                         = ' '
*   TARGETSYSTEM                      = ' '
*   START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
*   START_ON_WORKDAY_NR               = 0
*   WORKDAY_COUNT_DIRECTION           = 0
*   RECIPIENT_OBJ                     =
*   TARGETSERVER                      = ' '
*   DONT_RELEASE                      = ' '
*   TARGETGROUP                       = ' '
*   DIRECT_START                      =
* IMPORTING
*   JOB_WAS_RELEASED                  =
* CHANGING
*   RET                               =
* 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
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Former Member
0 Kudos
745

You can use the FM in the response above to write a program to schedule each batch job required for the next week. Then schedule this program to run weekly in SM36. That should get you through.

Former Member
0 Kudos
745

Hi,

While scheduling a background job we need to specify conditions that will trigger the job to start.

Steps:

1. Choose the Start condition button at the top of the Define Background Job screen.

2. Choose the button at the top of the Start Time screen for the type of start condition you want to use (Immediate, Date/Time, After job, After event, or At operation mode) and complete the start time definition in the screen that appears.

3. For the job to repeat, check the Periodic job box at the bottom of the Start Time screen and choose the Period values button below it to define the frequency of repetition (hourly, daily, weekly, monthly, or another specific time-related period). Then choose the Save button in the Period values screen to accept the periodicity and return to the Start Time screen.

4. Once youu2019ve completed specifying the job start conditions, choose the Save button at the bottom of the Start Time screen to return to the Define Background Job.

Make sure that the background job is in released status.

regards,

raghu

Moderator message: do not copy/paste without credit, this is the fastest way to account deletion, and unrelated to the question on top of that!

http://www.google.com/search?q=%22ChoosetheStartconditionbuttonatthetopof+the%22&hl=en&source=hp&lr=&aq=f&aqi=&aql=&oq=&gs_rfai=

Edited by: Thomas Zloch on Nov 25, 2010 10:17 AM

0 Kudos
745

Hi,

Thank you for reply. I already have the steps for SM36, but I am not able to schedule it on the condition based criterion's.

Ideally it should run between the 9:00 AM to 9:00 PM time frame, every after one hour should get triggered automated on daily on working days.

I played around SM36 unfortunmately not get any clues for end time there. So tried out for SCMA.

If anybody has went through the same conditions, help would be appreciated.

Regards,

Sharvari Joshi.

0 Kudos
745

Self Solved with the help of SCMA.

0 Kudos
745

Hi,

Could you please explain , how u used the t-code SCMA and resolved the issue.

I'm having the same requirement where i need to run the job from 8 AM to 8 PM everyday.

Thanks,

Sre