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: 

Getting factory calender weekly duration timings

Former Member
0 Kudos

hi all,

I have a scenario to get the factory calender weeky avaialable(working) timings like

MONDAY - 8:00 TO 17:00 etc.,

how to get these values is there any function module associate to get those value by passing date rule id.

Appreciate ur help

thanks

viswa

2 REPLIES 2

Former Member
0 Kudos

check below code...

DATA: W_FACTORYDATE LIKE SCAL-FACDATE.

  • Convert Delivery Date to Factory Date

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

CORRECT_OPTION = '-'

DATE = I_EINDT

FACTORY_CALENDAR_ID = I_FABKL

IMPORTING

DATE = E_EINDT

FACTORYDATE = W_FACTORYDATE

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.

  • Find the Lower Limit of Delivery date

E_LOWER = E_EINDT.

IF I_VINT1 NE 0.

W_FACTORYDATE = W_FACTORYDATE - I_VINT1.

CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'

EXPORTING

FACTORYDATE = W_FACTORYDATE

FACTORY_CALENDAR_ID = I_FABKL

IMPORTING

DATE = E_LOWER

EXCEPTIONS

CALENDAR_BUFFER_NOT_LOADABLE = 1

FACTORYDATE_AFTER_RANGE = 2

FACTORYDATE_BEFORE_RANGE = 3

FACTORYDATE_INVALID = 4

FACTORY_CALENDAR_ID_MISSING = 5

FACTORY_CALENDAR_NOT_FOUND = 6

OTHERS = 7.

ENDIF.

  • Find the Upper Limit of Delivery date

E_UPPER = E_EINDT.

IF I_VINT2 NE 0.

W_FACTORYDATE = W_FACTORYDATE + I_VINT1 + I_VINT2.

CALL FUNCTION 'FACTORYDATE_CONVERT_TO_DATE'

EXPORTING

FACTORYDATE = W_FACTORYDATE

FACTORY_CALENDAR_ID = I_FABKL

IMPORTING

DATE = E_UPPER

EXCEPTIONS

CALENDAR_BUFFER_NOT_LOADABLE = 1

FACTORYDATE_AFTER_RANGE = 2

FACTORYDATE_BEFORE_RANGE = 3

FACTORYDATE_INVALID = 4

FACTORY_CALENDAR_ID_MISSING = 5

FACTORY_CALENDAR_NOT_FOUND = 6

OTHERS = 7.

ENDIF.

Former Member
0 Kudos

FACTORYDATE_CONVERT_TO_DATE

This function module returns the calendar date for the factory date and the factory calendar passed.

DATE_CONVERT_TO_FACTORYDATE

This function module returns the factory date for the date and factory calendar passed. You can specify with a parameter whether the next or the previous working day is returned if the day is not a working day.

regards,

srinivas

<b>*reward for useful answers*</b>