on 2022 Aug 03 1:10 AM
Hi gurus.,
I would like to know if we can let's say schedule a background job to run daily but it should start with workday 2?
One thing I noticed when scheduling the job when I set to start on workday 2 is that it becomes a monthly job which runs once a month on WD2 rather than daily after WD2..
Easier way to put it is that the job should not run on the 1st of every month.
I'm not sure if I am doing something wrong here or if this is possible
Request clarification before answering.
Hi s_ng
I assume you are Scheduling a Standard program. Here are the options. Either it is a standard or z-program,
You write one wrapper program - In that a simple code that checks the date (sy-datum+6(2) ne 01). If it is true then submit the program else exit.
Then schedule that wrapper program in SM37.
The sample of your wrapper program Z-JOB1.
if ( sy-datum(6)+2 ne '01' ).
SUBMIT <your actual program>.
else.
endif.
In SM36 you schedule this Z_JOB1 program.
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, yes, I guess it could be done using a wrapper program only. However, as it is about working days the factory and holiday calender has to be considered.
data: fabcalOfMonth type standard table of CASDAYATTR.
data: fromDate type d,
toDate type d.
" Set 1st day of current month.
fromDate = sy-datum.
fromDate+6 = '01'.
" Set last day of current month.
toDate = fromDate.
toDate+6 = '28'.
add 4 to toDate. " Next month
toDate+6 = '01'. " 1st day of the next month
subtract 1 from toDate. " Last day of the current month.
" Now get the working days for the whole month.
call function 'DAY_ATTRIBUTES_GET'
EXPORTING
FACTORY_CALENDAR = '01' " <- use your factory calendar
HOLIDAY_CALENDAR = '03' " <- use your public holiday calendar
DATE_FROM = fromDate
DATE_TO = toDate
TABLES
DAY_ATTRIBUTES = fabcalOfMonth
EXCEPTIONS
FACTORY_CALENDAR_NOT_FOUND = 1
HOLIDAY_CALENDAR_NOT_FOUND = 2
DATE_HAS_INVALID_FORMAT = 3
DATE_INCONSISTENCY = 4
OTHERS = 5.
if sy-subrc <> 0.
" some error handling.
ENDIF.
" Get 1st working day of month.
read table fabcalOfMonth assigning field-symbol(<day>)
with key freeday = ''.
if sy-datum <> <day>-date. " Not 1st working day of the month?
submit <your_program>.
endif.
User | Count |
---|---|
116 | |
8 | |
7 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.