2007 Dec 26 9:37 AM
I need to fine the difference between two dates in which i need to exclude saturdays,sunday & public holidays.
Regards
Suchithra
2007 Dec 26 9:48 AM
2007 Dec 26 9:49 AM
Hi,
Use FM FIMA_DAYS_BETWEEN_TWO_DATES_2. In Field I_SKALID give the factory calender. It will give you diff between two dates in working days.
Regards,
Lalit
2007 Dec 26 3:49 PM
hi Lalit
Thnks for ur reply
I tried to use this function module but i could not get any values for this .
secondly we haven't specified the factory calender as we use public calesnder
2007 Dec 26 4:03 PM
Hi Suchitra
Find out with ur FC, which calender u need to use.. bcoz there are 2 or 3 types of calenders... Factory calender ,,,.
The factory day is a number assigned to each working day in plant calendar. The functions are FACTORYDATE_CONVERT_TO_DATE and DATE_CONVERT_TO_FACTORYDATE and they are documented directly in SAP
http://abaplog.wordpress.com/2007/03/15/working-with-sap-plant-calendars/
2007 Dec 27 5:54 AM
Hi
I spoke to FC
We are using holiday calender
HEnce we need to use holiday calender.
Regards,
Suchithra
2007 Dec 27 6:00 AM
http://help.sap.com/saphelp_nw04/helpdata/en/e1/52e9c8f7cb11d2a2b000a0c943858e/content.htm
DAY_ATTRIBUTES_GET Return useful information about a day. Will tell you the day of the week as a word (Tuesday), the day of the week (2 would be Tuedsay), whether the day is a holiday, and more.
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.
HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
HR_DISPLAY_BASIC_LIST is an HR function, but can be used for any data. You pass it data, and column headers, and it provides a table control with the ability to manipulate the data, and send it to Word or Excel. Also see the additional documentation here.
HR_GET_LEAVE_DATA Get all leave information (includes leave entitlement, used holidays/paid out holidays)
2007 Dec 27 6:05 AM
Hi,
There is a Table TFACD which stores the Factory Calender.
You can know the value of the factory calender from this table.
If the FM which I have is not working try using the FMs given by our other friends. Meanwhile Let me serach if I can find some thing,
Regards.
Lalit
2007 Dec 26 9:50 AM
Check these programs
RWSAF0001_FORM_PUB_HOLIDAYS (include program)
SAPLHRSEN00CRULE_CALE_DAYS (Functional Pool)
MM61MF78_DELTA_WORKINGDAYS (include Program)
RPTHRT01_EVALUATE_DAYS (include Program)
Reward Points if useful.
2007 Dec 26 9:56 AM
Check the Function Modules
HR_SGPBS_YRS_MTHS_DAYS Calculate years, months, days & calender days between 2 given dates
DAYS_BETWEEN_TWO_DATES
LEAP_DAYS_BETWEEN_TWO_DATES
HRWPC_PCR_CHECK_WORKINGDAYS
K_ABC_WORKDAYS_FOR_PERIODS_GET
RH_REQUEST_ON_WORKINGDAYS
WLB3_GET_NUMBER_OF_WORKDAYS
2007 Dec 26 5:07 PM
2008 Feb 19 3:57 AM
Hi all
I need to calculate the SLA.
Start date _100 working days .
Please help me how to calculate this date
Suchithra
2008 Feb 19 3:59 AM
Hi
Staring date + 100 working days
How to calculate this date
suchithra
2008 Feb 19 4:28 AM
2008 Feb 19 4:31 AM
data: it_days like standard table of rke_dat .
call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
exporting
i_datab = first_date
i_datbi = last_date
i_factid = p_v_calendar_code
tables
eth_dats = it_days
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_days lines p_v_working_days.
P_v_working _days will have the number of working days.
2008 Feb 19 4:31 AM
2008 Feb 19 4:35 AM
Check my last post...is it helping you ???
You pass the dates it will tell u the working days for the date range...
2008 Feb 19 4:41 AM
I need to get the date by adding the number of workingdays to the start date
for ex
19.01.2008 + 100 working days = date ? i need to calculate this date
suchithra
2008 Feb 19 5:08 AM
Create A Functional Module ..Place the below code in it.
Import parameters:
PLANT TYPE T001W-WERKS
I_STARTTIME TYPE T
I_STARTDATE TYPE D
I_ADDTIME TYPE T
I_ADDDAYS TYPE I
Export Parameters:
E_ENDTIME TYPE T
E_ENDDATE TYPE D
Exceptions:
CALENDAR_BUFFER_NOT_LOADABLE Factory calendar could not be buffered
CORRECT_OPTION_INVALID CORRECT_OPTION is not '+' or '-'
DATE_AFTER_RANGE Date is later than factory calendar definition
DATE_BEFORE_RANGE Date is earlier than factory calendar definition
DATE_INVALID Invalid date format
FACTORY_CALENDAR_NOT_FOUND Factory calendar is not in buffer
Just copy the above things and paste it as your FM Parameters.
Then in the source code area paste this code
data : differenz type i,
wk_adddays type i,
wk_workingday type i,
wk_fabkl like t001w-fabkl.
data : wk_factorydt type dats.
clear wk_fabkl.
select single fabkl into wk_fabkl from t001w client specified
where mandt = sy-mandt
and werks = plant.
e_enddate = i_startdate.
if i_adddays > 1.
wk_adddays = i_adddays.
else.
wk_adddays = i_adddays.
endif.
wk_workingday = 0.
while ( wk_adddays ge 0 ).
call function 'DATE_CONVERT_TO_FACTORYDATE'
exporting
date = e_enddate
factory_calendar_id = wk_fabkl
importing
date = wk_factorydt.
.
if wk_factorydt eq e_enddate.
wk_adddays = wk_adddays - 1.
endif.
if wk_adddays ge 0.
e_enddate = e_enddate + 1.
endif.
endwhile.
*** This clause will add time to the end date and display
*** the final end date and end time.
e_endtime = i_starttime + i_addtime.
differenz = e_endtime - i_starttime.
if differenz < 0.
e_enddate = e_enddate + 1.
else.
e_enddate = e_enddate.
endif.
wk_workingday = 0.
while ( wk_workingday <> 1 ).
call function 'DATE_CONVERT_TO_FACTORYDATE'
exporting
date = e_enddate
factory_calendar_id = wk_fabkl
importing
date = wk_factorydt.
if e_enddate eq wk_factorydt.
wk_workingday = 1.
else.
wk_workingday = 0.
endif.
e_enddate = wk_factorydt.
endwhile.
When executing : provide the startdate and days = 100.
It will give u the output date as u needed.
or if u need just apply this as u r coding...
any doubt revert.....:-)
2008 Feb 19 4:51 AM