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.
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.
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
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"
Add a comment