How to Set a Scheduler Job to Submit a UBE Every 5 Minutes for a Specific Time Range

Purpose of Document

This document discusses a possible way to implement a scheduled job for a specific time range through a custom routine.  There may be a need to set up Schedule Job for a specific time range (for example, 07:00 a.m. through 07:00 p.m.) to call a certain UBE every 5 minutes.



This note explains all possible ways to implement a scheduled job for a specific time range for these reasons:


Business Requirement:

A certain job has to be running during office hours based on transaction end-user performance. So any type of system level tasks can be performed after office hours without affecting a schedule job set. Through this scheduled job can be set through the batch job.


Technical Specification:
Before creating a custom UBE, analyze the exiting routing through standard Scheduler application P91300 (Schedule Jobs). To currently set a scheduled job at least two tables F91300 (Schedule Job Master) and F91320 (Job Schedule) will be populated. So this routine will populate these two tables which can be handled by the Scheduler Kernel and Queue Kernel.

  1. Create a Schedule Job in P91300 (Work with Scheduled Jobs) to populate F91300.  For example, R47041 (EDI_Inbound)
  2. Determine how many recurrences for the need to be created.  Example: in a 12 hour period, the schedule the job would run 144 times, if it needs to run every 5 minutes.
  3. Call B980009 (GetUTCTime) to get "VA evt_SchedulerStartTime"
  4. Call N91300A (CommitRecurrencPatternToDB).  This BSFN determines and adds records for the job to F91320.
  5. Set schedule for UBE1 created here before 07:00 a.m. with recurrence of A day

 

Notes:


Code Example:

  1. Assign (or get is from Processing Options) ScheduleJobName
  2. Set ScheduledStartTime (format hhmmss) either hard code or processing options
  3. Get/Assign Max records as computed above (depending on recurrence and time gap, this value can vary)

    VA rpt_ScheduledJobName = "EDI_Inbound"
    VA evt_ScheduledStartTime = "070000"
    VA evt_MaxScheduledRecords = "144"


  4. Get recurrence Type and Timezone

    F91300.Fetch Single

    VA rpt_ScheduledJobName = TK Scheduled Job Name
    VA evt_RecurrenceType <- TK Recurrenc Type
    VA evt_TimeZoes <- TK Time Zone List

  5. Get UTC time to assign start time

    Get UTC Time (B9800009 - GetUTCTime)
    VA evt_SchedulerStartTime <- BF mnUTCTime
    SL DateToday -> BF jdDate
    VA evt_ScheduledStartTime -> BF mnTime
    "2" -> BF cUTC_Local
    VA evt_TimeZoes -> BF szTimeZone
    "1" -> BF cDaylightSavings


  6. Create F91320 (Job Schedule)

    Determine and add F91320 Records for Job (N91300A - CommitRecurrencPatternToDB)
    VA rpt_ScheduledJobName -> BF szScheduledJobName
    VA evt_SchedulerStartTime -> BF mnSchedulerStartTime
    VA evt_RecurrenceType -> BF szRecurrenceType
    VA evt_TimeZoes -> BF szTimeZones
    VA evt_DaylightSavings -> BF cDaylightSavings /* same with processing option value of P91300 */"5" -> BF mnScheduledMinutes
    VA evt_MaxScheduledRecords -> BF mnMaxScheduledRecords

    "2" -> BF cYesOrNoEntry /* Local or UTC */

 

Disclaimers: