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 calendar

Former Member
0 Kudos

how can i set factory calendar from sunday to saturday, because when we calculate weeks upto perticular date, if we think week as sunday to saturday it will give different value,and when think week as monday to sunday the value will be different.

Thanks in advance,

Venkat

1 ACCEPTED SOLUTION

Former Member
0 Kudos

*To calculate week no for particular date

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

DATE = SY-DATUM " any date

IMPORTING

WEEK = WEEK_NO ." Week no for particular date

*To calculate week Start & End date

CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'

EXPORTING

DATUM = SY-DATUM " Current date (ITAB DATE)

WEEK_PST = '0'

WEEK_FTR = '0'

IMPORTING

BEGDA = STR_WEEK_DATE " Week start date

ENDDA = END_WEEK_DATE. " Week end date

CNT = SY-DATUM - STR_WEEK_DATE + 1.

*To calculate Months ending date

CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'

EXPORTING

I_DATE = SY-DATUM " Any date

IMPORTING

E_DATE = END_MONTH_DATE. " Month's ending date

*to calculate particular day No for any give date.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = SY-DATUM " any date

IMPORTING

DAY = DAYNO1. " particular day no.

DAYNO = DAYNO1.

*To calculate particular day name with the day no

CALL FUNCTION 'BKK_GET_DAY_OF_WEEK'

EXPORTING

I_DAY = DAYNO " week day no.

IMPORTING

E_WDAY = CURRENT_DAY_NAME. " Week day name for the week day no.

  • to Calculate the next week

CALL FUNCTION 'NEXT_WEEK'

EXPORTING

CURRENT_WEEK = WEEK_NO "Current week,

IMPORTING

NEXT_WEEK = WEEK_NO. " Next week

  • to calculating starting date of the week

CALL FUNCTION 'WEEK_GET_FIRST_DAY'

EXPORTING

WEEK = WEEK_NO "week No

IMPORTING

DATE = STR_WEEK_DATE. " Starting date of the particular week

*To Calculate particular day No for any given date

CALL FUNCTION 'DAY_IN_WEEK'

EXPORTING

DATUM = STR_WEEK_DATE " Any date

IMPORTING

WOTNR = DAY. " Day no for a giveN date

Thanks & Regards,

Dileep .C

7 REPLIES 7

former_member305388
Active Contributor
0 Kudos

Try CO2R_REL_SET_FACTORY_CALENDAR

Former Member
0 Kudos

Hi,

Check FM: DATE_CONVERT_TO_FACTORYDATE

Regards.

Former Member
0 Kudos

Factory calendars (defined in transaction SCAL) don't define week numbers, only day numbers. (I assume you are not talking about shift calendars...?)

It sounds as if what you are looking for is a way to calculate the number of weeks between two dates. If so, there are various functions that might help.... See functions WEEK_GET_FIRST_DAY, BWSO_DATE_GET_FIRST_WEEKDAY and FIMA_DATE_SHIFT_WITH_WEEKDAY. For BWSO_DATE_GET_FIRST_WEEKDAY, the first day of the week is defined for each user in table SCOWNER field WEEK_START. The others use Monday. However I'm not sure any of these functions does exactly what you want.

If you want the number of weeks between two dates D1 and D2 don't you just need ( (D2 - D1) / 7 ) ignoring fractions ?

If you want to calculate a week number for date D2 based on a Sunday to Saturday week, you can let D1 be the final Saturday of the previous year.

best wishes

Ed

0 Kudos

Hi.

On tx SCAL you can check all the calendars and review the holidays, weeks, etc

In this path Enterprise Structure - Definition - Logistics General - Define, copy, delete, check plant you can review the join between your plant and your factory.

Pls check in detail

Former Member
0 Kudos

*To calculate week no for particular date

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

DATE = SY-DATUM " any date

IMPORTING

WEEK = WEEK_NO ." Week no for particular date

*To calculate week Start & End date

CALL FUNCTION 'HRWPC_BL_DATES_WEEK_INTERVAL'

EXPORTING

DATUM = SY-DATUM " Current date (ITAB DATE)

WEEK_PST = '0'

WEEK_FTR = '0'

IMPORTING

BEGDA = STR_WEEK_DATE " Week start date

ENDDA = END_WEEK_DATE. " Week end date

CNT = SY-DATUM - STR_WEEK_DATE + 1.

*To calculate Months ending date

CALL FUNCTION 'BKK_GET_MONTH_LASTDAY'

EXPORTING

I_DATE = SY-DATUM " Any date

IMPORTING

E_DATE = END_MONTH_DATE. " Month's ending date

*to calculate particular day No for any give date.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = SY-DATUM " any date

IMPORTING

DAY = DAYNO1. " particular day no.

DAYNO = DAYNO1.

*To calculate particular day name with the day no

CALL FUNCTION 'BKK_GET_DAY_OF_WEEK'

EXPORTING

I_DAY = DAYNO " week day no.

IMPORTING

E_WDAY = CURRENT_DAY_NAME. " Week day name for the week day no.

  • to Calculate the next week

CALL FUNCTION 'NEXT_WEEK'

EXPORTING

CURRENT_WEEK = WEEK_NO "Current week,

IMPORTING

NEXT_WEEK = WEEK_NO. " Next week

  • to calculating starting date of the week

CALL FUNCTION 'WEEK_GET_FIRST_DAY'

EXPORTING

WEEK = WEEK_NO "week No

IMPORTING

DATE = STR_WEEK_DATE. " Starting date of the particular week

*To Calculate particular day No for any given date

CALL FUNCTION 'DAY_IN_WEEK'

EXPORTING

DATUM = STR_WEEK_DATE " Any date

IMPORTING

WOTNR = DAY. " Day no for a giveN date

Thanks & Regards,

Dileep .C

0 Kudos

Hi Venkat,

Now with this Date & Day & Week calculation Function Modules,

You can calculate the necessity requirements...

Thanks & regards,

Dileep .C

Former Member
0 Kudos

Hi,

Check this FM 'CO2R_REL_SET_FACTORY_CALENDAR'

Regards,

Jyothi CH.