07-06-2009 5:30 AM
call function 'DATE_CONVERT_TO_FACTORYDATE'
exporting
correct_option = '+'
date = sy-datum
factory_calendar_id = 'U2'
importing
date = lv_date
factorydate = lv_factory_lrmdt
EXCEPTIONS
CALENDAR_BUFFER_NOT_LOADABLE = 1
CORRECT_OPTION_INVALID = 2
DATE_AFTER_RANGE = 3
DATE_BEFORE_RANGE = 4
DATE_INVALID = 5
FACTORY_CALENDAR_NOT_FOUND = 6
OTHERS = 7.
after the fm is executed , i am not understanding how the lv_date and lv_date_lrmdt is calculated in fm. especially i nned to understand how lv_factory_lrmdt i calculated. please help
07-06-2009 5:33 AM
HI,
In the factory calendar, the working days are numbered sequentially fromthe first working day. The working day numbers are called the factory date. This function module calculates the factory date for a calendar date. If the date passed is not a working day, the next or previous working day is calculated.
Regards,
yogesh
07-06-2009 5:40 AM
07-06-2009 6:03 AM
Hello Ganesh
System function 'CAL_CONVERT_DATE_TO_FDATE' is called inside this FM and there is file sapactab.h where all the relevant filed data is stored. This value of 4410 is stored in the field C_FDAY in the SAP kernel file.
Hope this helps.
Thanks
Shivika
07-06-2009 6:05 AM
yep.. u r right..like to know what is this number...how is it calculated?
07-06-2009 6:44 AM
hello ganesh
please follow the path :
SPRO->SAP Reference IMG->General Settings -> Maintain calendar ->Factory calendar ->Select U2 and choose Calendar icon.
You will see in the Day column there is a base number. 4410 is calculated on this base number i.e base number + working days = 4410.
You will also see how the base numbers have been calculated based on the valid from year in the calendar.
Hope this helps
Thanks
Shivika
07-06-2009 5:59 AM
Hi Ganesh,
the working days are numbered sequentially fromthe first working day. The working day numbers are called the factory date.
This function module count this days from it's first working day.
It is giving factory date 4410 means till today 4410 working days in that factory.
While calculating this it ignores holidays.
Eg. if u pass date as 05.07.2009 which is sunday. It will return u next working day that is 06.07.2009..
Hope it is much helpful to you.