Application Development and Automation 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: 
Read only

Factory calendar

Former Member
0 Likes
674

hi

What is factory calendar i what the logic, i want include the logic in my program

thanks

sweatha

hi

What is factory calendar i what the logic, i want include the logic in my program

thanks

sweatha

3 REPLIES 3
Read only

Former Member
0 Likes
608

Hi, use this function module.

HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.

HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the

date is a holiday by checking the parameter HOLIDAY_FOUND.

Example:

data: ld_date like scal-datum default sy-datum,

lc_holiday_cal_id like scal-hcalid default 'CA',

ltab_holiday_attributes like thol occurs 0 with header line,

lc_holiday_found like scal-indicator.

CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO'

EXPORTING

date = ld_date

holiday_calendar_id = lc_holiday_cal_id

WITH_HOLIDAY_ATTRIBUTES = 'X'

IMPORTING

HOLIDAY_FOUND = lc_holiday_found

tables

holiday_attributes = ltab_holiday_attributes

EXCEPTIONS

CALENDAR_BUFFER_NOT_LOADABLE = 1

DATE_AFTER_RANGE = 2

DATE_BEFORE_RANGE = 3

DATE_INVALID = 4

HOLIDAY_CALENDAR_ID_MISSING = 5

HOLIDAY_CALENDAR_NOT_FOUND = 6

OTHERS = 7.

if sy-subrc = 0 and

lc_holiday_found = 'X'.

write: / ld_date, 'is a holiday'.

else.

write: / ld_date, 'is not a holiday, or there was an error calling the function'.

endif.

reward points, if it is useful,

regards,

satish.

Read only

Former Member
0 Likes
608

It is set company code level,plant level check SCAL t code.

Reward Points if useful.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
608

There will be a factory id for each plant...please check it and pass it to tis FM

CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'

EXPORTING

I_DATAB = WK_FIRST_DATE <--startdate

I_DATBI = WK_LAST_DATE <--Enddate

  • I_FACTID = 'YC' <----ID*

TABLES

ETH_DATS = IT_RKE_DAT_HP <--table to store dates

EXCEPTIONS

DATE_CONVERSION_ERROR = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DESCRIBE TABLE IT_RKE_DAT_HP LINES WK_DAYS_TOTL_HP.

this will give the no of working days between a date range.