Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

FM DATE_CONVERT_TO_FACTORYDATE

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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

0 Kudos

executing the FM gives lv_factory_lrmdt = 4410. how?

0 Kudos

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

0 Kudos

yep.. u r right..like to know what is this number...how is it calculated?

0 Kudos

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

Former Member

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.