cancel
Showing results for 
Search instead for 
Did you mean: 

How to schedule a job in such a way as it runs the last day of every month

Former Member
0 Kudos

HI Experts,

I needed to schedule a job today, and during implementing found and issue/interesting question and would like to ask your help on this.

So the situation is the following:

- i scheduled a job what will run periodically (once per month) and will responsible for Close (open) Period for Material Master Records (MMPV)

- used RMMMPERI and saved variant etc.....

My main question/issue is that: I wanted to schedule this job in such a way as it will run the last day of every month. Since not each month contains 31 days (for example february has just 28 days next year) so i can not enter into the date field e.g.: 31.11.2015 and set it to run periodically becuase if i think well (correct me if i am wrong) this job will not run in february 2016 since february has just 28 days.

Anyway i have scheduled the job to run 28. 10.2015 at 23:50 and set it to run periodically ( there is no month what contains less than 28 days) so it will run in case of month contains 30,31 or 28 days.

So all in all my question is:

- is there any option to schedule a job in such a way as it runs the last day of every month without reference to that how many days the month contains ?

Many thanks in advance,

Br David

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi all,

Many thanks for both of you for the usefull replies. Definetly this is the correct solution, but i have some concerns:

- if i define such a factory calendar that defines every day as working day using SCAL i think it can causes some issues:

      - the system will use this calendar during shipping, MRP calculation etc. So for example the system can create shippement(in case automatic shippment creation) for saturday but no one is working on saturday in the plant. So that is why i decided to do not use this solution and keep the settings what i have descirbed in my comment (job will run on 27th of every mont).

Many thanks one more time i really appreciate your quick help.

Br David

feng_shi
Active Participant
0 Kudos

Hi David,

>So that is why i decided to do not use this solution and keep the settings what i have descirbed in my >comment (job will run on 27th of every month).

How do you make sure that 27th of every month of every year is workday(neither the weekend nor public holiday)?

Actually, when you define the factory calendar, you can specify workdays.

when you schedule the job from SM36 by using the factory calendar, you can specify the job to be run on every last workday of every month.

Thanks and best regards,

Shi Feng

Former Member
0 Kudos

Hi Shi,

You are right i can not make sure about that 27th of every month of every year is workday but actually i do  not need to. Let me describe my situation in detailed:

- so i wanted to schedule a job what will be responsibe for Close (open) Period for Material Master Records (MMPV).

- used RMMMPERI program and saved variant etc.....

- since this program what is used by job (job actually will run this program) will leave the current period open and will open a new one at the same time.

E.g.: period 11 has to be opened. In such a case the job will open period 11 and at the same time will leave period 10 open as well.

Later (next month) the situation is tha same: period 12 has to be opened and 11 has to be kept open as well and so on.

So for me it is not censoriously important that the job has to run exactly on the last day of the month because as you  can see on the above mentioned example if it will run few days earlier than last day of the month is still fine, since current period will stay open and new  will be opened as well (despite of the new period is open the current one still can be used).

So for me that was important to make sure my job will run every month (towards end of every month).That is why i have decided to  use 27th of every month because none of the month contains less than 28 days (once in 4 year february has just 28 days) so my job will run 100 % sure.

So actually my job is done and scheduled but i was curious about that how i can schedule a job what will run exactly on the last day of every month, that is why i have posted my question.

Let me to make my question a bit simple: is there any way to schedule a job to be run on the last day of every month (last day do not need to be workday) without touching the current factory calendar ?

Many thanks in advance,

Br David

feng_shi
Active Participant
0 Kudos

Hi David,

Thank you for the detail description.

I think everything is clear now.

To answer you question:

I don't think that there is a way to schedule a job to be run on the last day of every month without using factory calendar.

Thanks and best regards,

Shi Feng

Answers (3)

Answers (3)

yakcinar
Active Contributor

Hello David,

You can define a job that starts every end of the monts using SM36 and SCAL.

First of all define a calendar using SCAL that defines everyday as workday.

Then when you are defining the job start condition goto last button and enter your calendar and 1 as workday and select end of month.

As you can see below screen this condition will start your program will start every end workday of the month.  

Regards,

Yuksel AKCINAR

feng_shi
Active Participant
0 Kudos

Hi David,

Yes, just like Yuksel replied previously, you need to define Factory Calendar(t-cd: SCAL) and use it.

Meanwhile, there is BTC wiki page which included known typical issues.

http://wiki.scn.sap.com/wiki/x/eAAOG

I believe you will get benefit when you encounter background job issues.

Thanks and best regards,

Shi Feng

former_member374571
Discoverer
0 Kudos

Hi Experts

could you please advice on below job scheduling variant for business requirement

the job needs to be run on every month 20th 2021 but the open items needs to clear on Oct-2020

I.e 1. If the scheduled job runs on January 20th 2021, I would only want to consider line items October 1st to October 31, 2020

2. If the job runs February 20th, 2021, I would only want to consider line items November 1 through November 30, 2020

kindly advice to full fill the above requirement

JL23
Active Contributor
0 Kudos

While the last day of each month is different, the first day is not, so why not just schedule the job at 0:01 on the 1st of each month?

Former Member
0 Kudos

Hi Jürgen,

Thanks for you help, you are totally right i do not know how i did not think about this and skipped this solution

I will schedule my job as you adviced really appreciate it.

Many thanks,

Br David