General introduction about the factory calender and how to get the dates validated based on calender key
Tcode--> SCAL
click display
If a public
holiday calendar or a factory calendar is set, the non-working days in the
relevant region or in the company are highlighted in color in the calendar
display and are not included in the search for appointments. By default, a
calendar that does not contain public holidays is assigned to the appointment
calendar.
Tcode--> SCAL
click display
Based on the calendar key T001W-FABKL get the valid from and
valid to date for a plant.
Example: -
Suppose get the factory calendar for a plant in organization
First get the cost centre for the org unit à
get the business area and company code àget the plant àget
the key from table T001W ( Plants/Branch)
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
ReplyDeleteEXPORTING
CORRECT_OPTION = '+'
DATE = P_PFINSH
FACTORY_CALENDAR_ID = G_F_FABKL
IMPORTING
DATE = P_L_F_DATE
* FACTORYDATE =
* WORKINGDAY_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
.
IF SY-SUBRC <> 0.
ENDIF.