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

Calendar Functions

Former Member
0 Likes
1,234

Hello all.

Wich functions should i use to obtain the calendars and their associations with the plant? Is there any function that returns the nonworking days as intervals?

I also would like to know how to obtain shifts.

Thank you

Nuno Silva

1 ACCEPTED SOLUTION
Read only

former_member181966
Active Contributor
0 Likes
1,143

Try

<b> call function 'CY_GET_TIMEINTERVAL'</b> exporting

calendar_id = rc65a-kalid

fiscal_year_variant = rc65a-periv

period_type = rc65a-zaper

sdatefrom = rc65a-zavon

sdateto = rc65a-zabis

importing

datefrom = rc65a-lidav

dateto = rc65a-lidab

datefrom_string = rc65a-zavon

dateto_string = rc65a-zabis

exceptions

interval_cannot_be_computed = 01.

FYI

<u><b>INCLUDE PROG :MC65AFP1</b></u>

Hope this’ll give you idea!!

<b>P.S award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Hello all.

Wich functions should i use to obtain the calendars and their associations with the plant? Is there any function that returns the nonworking days as intervals?

I also would like to know how to obtain shifts.

Thank you

Nuno Silva

7 REPLIES 7
Read only

former_member181966
Active Contributor
0 Likes
1,144

Try

<b> call function 'CY_GET_TIMEINTERVAL'</b> exporting

calendar_id = rc65a-kalid

fiscal_year_variant = rc65a-periv

period_type = rc65a-zaper

sdatefrom = rc65a-zavon

sdateto = rc65a-zabis

importing

datefrom = rc65a-lidav

dateto = rc65a-lidab

datefrom_string = rc65a-zavon

dateto_string = rc65a-zabis

exceptions

interval_cannot_be_computed = 01.

FYI

<u><b>INCLUDE PROG :MC65AFP1</b></u>

Hope this’ll give you idea!!

<b>P.S award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Read only

0 Likes
1,143

Saquib,

I could not get the function to work the way it should. It says the interval is not valid

Thank you

Message was edited by: Nuno Silva

Read only

Former Member
0 Likes
1,143

YOu can get the factory id from plants table T001w-FABKL.

FABKL is the field.

YOu can use the fm K_ABC_WORKDAYS_FOR_PERIODS_GET to get the working days in the interval specified.

The rest are non-working days.

Regards,

ravi

Read only

0 Likes
1,143

Ravi Kanth Talagana,

Thank you for the info on the plant's calendar.

That specific function asks for a parameter called CALL_PROG. What should i put there?

Function HOLIDAY_GET is quite usefull, but is there any way to convert this into intervals?

Thank you.

Read only

0 Likes
1,143

HI NUno,

The FM DATE_CONVERT_TO_FACTORYDATE will be more relevant to your requirement.

<b>date1 = start_date.

do.

if date1 = end_date.

exit.

endif.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING DATE = DATE1

FACTORY_CALENDAR_ID = CALENDAR

IMPORTING DATE = DATE2

FACTORYDATE = FACTORYD

WORKINGDAY_INDICATOR = WORKDAY

EXCEPTIONS CORRECT_OPTION_INVALID = 1

DATE_AFTER_RANGE = 2

DATE_BEFORE_RANGE = 3

DATE_INVALID = 4

FACTORY_CALENDAR_NOT_FOUND = 5.

if workday <> 'X'.

it_non_work_day-date = date1.

append it_non_work_day.

clear it_non_work_day.

endif.

date_1 = date_1 + 1.

enddo.</b>

REgards,

Ravi

Read only

Former Member
0 Likes
1,143

hi,

use factory calender for working days.

FM.

WSAF_GET_LAST_DAY_OF_MONTH

FKK_ADD_WORKINGDAY

  • check if day of the month is a working day or not

CALL FUNCTION 'ISU_CHECK_HOLIDAY'

EXPORTING

i_date = xyv_read_end

i_calendar1 = gc_factory_cal

IMPORTING

e_x_no_workingday = flg_is_non_working

e_x_is_holiday = flg_is_holiday

EXCEPTIONS

not_found = 1

calendar_error = 2

OTHERS = 3.

IF sy-subrc <> 0 .

  • do nothing

ENDIF.

regards

Read only

Former Member
0 Likes
1,143

YOu can use the fm HOLIDAY_GET to get the non working days.

Regards,

Ravi