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: 

factory calander calculation

Former Member
0 Kudos

Hi Experts,

I need to calculate the factory calendar based on the plant. I found the function Module DATE_CONVERT_TO_FACTORYDATE which will give the result based on the Factory id, this is

fine, I need to do the calculation based on the plant also for the country.

Is there any FM will solve this purpose or if i need to write the custom which are all the tables need to refer and let me know the calculation as well.

thanks in advance

sai

2 REPLIES 2

Former Member
0 Kudos

Hi,

I guess you can not calcualte based on the plant but on company code.

For this you need to know the PERIV for that company code.

Try DATE_TO_PERIOD_CONVERT and similar function modules.

Regards,

Santhosh.

shishupalreddy
Active Contributor
0 Kudos

Hello ,

Use the below code to get the factory calender details based on PLANT.

SELECT SINGLE *

FROM t001w

WHERE werks EQ p_werks.

CHECK sy-subrc = 0.

*-Convert start date into factory date

lb_scal-date = p_datum.

lb_scal-fcalid = t001w-fabkl.

g_fcalid = lb_scal-fcalid.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

correct_option = '+'

date = lb_scal-date

factory_calendar_id = lb_scal-fcalid

IMPORTING

date = lb_scal-date

factorydate = lb_scal-facdate

workingday_indicator = lb_scal-indicator

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.

Regards,