Sample Program: Start-Time Window with JOB_CLOSE

Use

* 
* Submit job:  start-time window defined, with periodic repeat and 
* with target system upon which the job is to run. 
* 
* In this case, you must provide start date settings.  You can 
* have the job started immediately with a JOB_CLOSE parameter, 
* set the start date yourself, or ask the user with 
* BP_START_DATE_EDITOR. 
* 
* Example:  Provide start-date specifications yourself. 
* 
  STARTDATE = '19970101'. 
  STARTTIME = '160000'. 
  LASTSTARTDATE = '19970101'. 
  LASTSTARTTIME = '180000'. 

  CALL FUNCTION 'JOB_CLOSE'
   EXPORTING
     JOBCOUNT     = JOBNUMBER     " Job identification: number
     JOBNAME      = JOBNAME       " and name.
     SDLSTRTDT    = STARTDATE     " Start of start-time...
     SDLSTRTTM    = STARTTIME     " window
     LASTSTRTDT   = LASTSTARTDATE " Optional: end of...
     LASTSTRTTM   = LASTSTARTTIME " start-time window
     PRDMONTHS    = '1'           " Restart at intervals of
     PRDWEEKS     = '1'           " the sum of the PRD*
     PRDDAYS      = '1'           " parameters
     PRDHOURS     = '1'
     PRDMINS      = '1'
     STARTDATE_RESTRICTION = BTC_DONT_PROCESS_ON_HOLIDAY
                                " Restrict job start to work
                                " days; don't start job if
                                " scheduled on holiday.
                                " Other values:
                                " BTC_PROCESS_BEFORE_HOLIDAY
                                " BTC_PROCESS_AFTER_HOLIDAY
     CALENDAR_ID  = '01'        " ID of SAP factory calendar
                                " for determining workdays
     TARGETSYSTEM = 'hs0011'    " Optional: name of the host
                                " system on which the job is
                                " to run.  Set only if
                                " absolutely required.
                                " Example: A required tape
                                " drive is accessible only
                                " from a single host system.
   IMPORTING                                                          
     JOB_WAS_RELEASED = JOB_RELEASED " If user has authorization   
                                     " to release jobs to run, job
                                     " is automatically released   
                                     " when it is scheduled.  This
                                     " field is set to 'x' if the  
                                     " job has been released.      
                                     " Otherwise, the job is sche-
                                     " duled but must be released  
                                     " by an administrator before  
                                     " it can be started.    
   EXCEPTIONS
     INVALID_STARTDATE    = 01
     JOBNAME_MISSING      = 02
     JOB_CLOSE_FAILED     = 03
     JOB_NOSTEPS          = 04
     JOB_NOTEX            = 05
     LOCK_FAILED          = 06
     OTHERS               = 99.

  IF SY-SUBRC > 0. 

<Error processing> 
  ENDIF.