cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to set a batch job to run on the last day of the month?

neil_hoff
Participant
0 Kudos

We need to have a job run on the Last day of every month at 11:30 PM.

Is this possible?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Neil,

I've been looking into running a job of ours on the last day of each month and I think this is the way to do it, but you need to test it out of course. It seems to work for us but I don't know if your set up is the same as ours!! I did this for an internal job of ours not an SAP job but you must be able to apply the same method. Once you have initally scheduled the job then using SM37, you can change the job in the normal way (shift F11 for example) . (Of course you can also do this when you run the job initially and then set to run in background mode)

Click on Start Condition.

In the Start Time pop up - Click on the >> on the upper right hand side of the screen

Enter in a relevant 7 day factory calendar (I used Y3 - which is the 7 day inc BH calendar)

Enter in workday 1.

Enter in the start time - in your case 23:00:00.

Leave the default in the do not execute before field (current date)

Click Workday relative to End of Month.

Then enter how many months you want this to run for

Then save.

When you then go back into this, it shows the last day of the month as the scheduled time.

Note that this is the first time I've tried this so I don't know how effective it is but I believe this will work.

I'm not a guru, just a BASIS admin relative beginner!! Hope this helps you

Regards

Mark

neil_hoff
Participant
0 Kudos

Thanks for the help!

We created a new calendar and set it to a 7 day work week including Holidays.

We tested by setting the Do not start before field to July 1st, August 1st, etc.. and checking the Job start on the main page for creating the batch job. For each month the Job start was the last day of the month.

Answers (2)

Answers (2)

Former Member
0 Kudos

In SM36 - Go to Start Conditions - Go to restrictions, Select - related Factory Calender, Workday and workday relative to End of Month.

It should answer your question.

neil_hoff
Participant
0 Kudos

Hi Ruchit,

That is exactly my problem. This program is a month end for finance and they have told me that it cannot be run on the first day of each month (This would make it easy). It has to run at 11:30 on the last day of the month, whether that day is the 28, 29, 30, or 31.

Hi Mukesh,

That sounds like it may work. One question though. The analyst has told me that It has to be on the very last day of the month even if it is not a work day. Does the resolution you have stated run on the last work day or the actuall last day of the month? Or is that something we have to setup?

Former Member
0 Kudos

Hello Neil,

The factory calender thing will also not work in your specific case. You have a requirement that is should run on the last working day of a month which is very variable. the factory calender to an extent gives you scope for variablilty but it has two drawbacks:

1. it does not consider non - working days.

2. for workdays also you need to explicitily state which work day . So if you specify 1 it mean 1st working day. Similarily 7 would mean 7th working day. You cannnot explicitily state last day of month (that also if it is working ).

But I have a question here. Which report are you trying to run. Is it standard SAP or custom report. That would be helpful for providing some sort of solution.

Regards.

Ruchit.

Former Member
0 Kudos

Hi Neil,

Actually I tried the method suggested by Mukesh.It is very close to ideal situation but not there still.WIth Mukesh's solution actually the working and non-owrking day issue can be sorted out. I was actually checking the general option for running jobs on basis of factory calender instrad of what Mukesh had suggested. However factory calender solution also won't help you Actually it is because if I understand correctly then while counting monthy thing SAP is not adding 30 or 31 days it is simply doing a mapping of 1st run date and subsequent run dates. What this means if you make a job monthly and run it today on 25th of April then the next run would be on 25th of May and the next one would be on 25th of June. So if you schedule this to start on 30th of April it will re run on 30 of May and not on 31st of May. Interesting thing would be how the job would run if you schedule it as monthy job with the first run on 31st of May. I guess it won't run on 30th June but would actually skip the month of June.Last day of month is too variable a quantity which can not be covered up a by a period like monthly.

Regards.

Ruchit

neil_hoff
Participant
0 Kudos

Hi Ruchit,

Thank you for the quick responses. I will get back to you with more information about the report, once I can get a hold of the analyst. She is not in the office today.

Neil

neil_hoff
Participant
0 Kudos

The batch jobs that she is trying to run on the last day of each month are for standard SAP trancodes for settlement and period close.

Does this help with a solution?

JPReyes
Active Contributor
0 Kudos

I think your best shot is to schedule the jobs manually... is not a lot of work to configure 12 jobs.

Actually you probably spended more time looking into it that the time it would take to schedule the jobs... sometimes simplycity is the best way to go.

Regards

Juan

JPReyes
Active Contributor
0 Kudos

Yes, you can schedule a job to run monthy at SM37... just schedule the start date at the end of the month an set the job periodical value to monthly.

Regards

Juan

Former Member
0 Kudos

Hi Juan,

I think there is a trick here because some months will have 31 days, some will have 30 and Feburary would have either 28 or 29 depending on whether it is leap year or not.What is your take on this ? I mean if you schedule a job to run on 15th and make it monthly periodic it will run every month on 15th coz every month has 15th in it. But last day of the month is a variable quantity.

Regards.

Ruchit.