03-30-2009 4:59 AM
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
03-31-2009 3:01 AM
*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
03-30-2009 5:02 AM
03-30-2009 5:16 AM
03-30-2009 10:45 PM
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
03-30-2009 10:54 PM
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
03-31-2009 3:01 AM
*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
03-31-2009 5:02 AM
Hi Venkat,
Now with this Date & Day & Week calculation Function Modules,
You can calculate the necessity requirements...
Thanks & regards,
Dileep .C
03-31-2009 6:29 AM
Hi,
Check this FM 'CO2R_REL_SET_FACTORY_CALENDAR'
Regards,
Jyothi CH.