2007 Jul 02 11:11 PM
Hi,
My current program gets all data based on the default date (in my case, the previous day's date, such that if today is 7/2, the program would get all daily movement data based on 7/1.)
However, say the program is ran on a Monday. The program has to be smart enough to not get data for sunday, of which there would be none. It would have to get friday's daily movement data. How do we get the previous billing date?
Also, say a week has a holiday. In that case, we would needed data from Friday and Saturday, if the report was executed on monday.
Please help.
All responses will be appreciated and rewarded.
Thank You,
John
2007 Jul 02 11:18 PM
Well John, what you need to do is apply your date to a calendar. See transaction SCAL. This transaction holds the calendars which have been setup for your company, there can be many which is the case for me. the trick is to know which one will work for you. Usually, there is one that will define what are working days in a company, which will define the weekend and holidays, then you can use this calendar id to adjust your date.
So say it is 7/1 and you subtract one from this date, of course it would be 6/30, which is a Sunday and not a working day, you would pass this 6/30 date to this function module and set the adjustment indicator to '-' which means the adjustment would be to go back as opposed to forward, this function would read the calendar and pass you back the next date that is a working day, what ever that may be in your system, saturday or sunday. The function module is.
DATE_CONVERT_TO_FACTORYDATE
Regards,
Rich Heilman
Hi,
My current program gets all data based on the default date (in my case, the previous day's date, such that if today is 7/2, the program would get all daily movement data based on 7/1.)
However, say the program is ran on a Monday. The program has to be smart enough to not get data for sunday, of which there would be none. It would have to get friday's daily movement data. How do we get the previous billing date?
Also, say a week has a holiday. In that case, we would needed data from Friday and Saturday, if the report was executed on monday.
Please help.
All responses will be appreciated and rewarded.
Thank You,
John
2007 Jul 02 11:18 PM
Well John, what you need to do is apply your date to a calendar. See transaction SCAL. This transaction holds the calendars which have been setup for your company, there can be many which is the case for me. the trick is to know which one will work for you. Usually, there is one that will define what are working days in a company, which will define the weekend and holidays, then you can use this calendar id to adjust your date.
So say it is 7/1 and you subtract one from this date, of course it would be 6/30, which is a Sunday and not a working day, you would pass this 6/30 date to this function module and set the adjustment indicator to '-' which means the adjustment would be to go back as opposed to forward, this function would read the calendar and pass you back the next date that is a working day, what ever that may be in your system, saturday or sunday. The function module is.
DATE_CONVERT_TO_FACTORYDATE
Regards,
Rich Heilman
2007 Jul 02 11:20 PM