06-26-2007 1:21 PM
Hi All,
How we can calculate no of working days between two dates,if working days are from monday to friday.
Thanks in advance.
Regards,
Sarala.
06-26-2007 1:23 PM
Hi,
You can use the following FM
CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
EXPORTING
i_datab = date1
i_datbi = date2
i_factid = 'GB'
TABLES
eth_dats = l_it_dat.
In i_factid you have to pass factory Id like for india 'IN' or some other coutnry
n pass two dates you will get only working days in between those two dates
according to that calender
Regards,
Padmam.
06-26-2007 1:23 PM
hi..
FIMA_DAYS_AND_MONTHS_AND_YEARS
HR_SGPBS_YRS_MTHS_DAYS
RKE_SELECT_FACTDAYS_FOR_PERIOD
check these .
reward if useful
regards
ashu
06-26-2007 1:23 PM
Hi Sarala,
Try to use this FM
WEEK_GET_NR_OF_WORKDAYS
Reward if useful
06-26-2007 1:23 PM
Hi,
You can use the following FM
CALL FUNCTION 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
EXPORTING
i_datab = date1
i_datbi = date2
i_factid = 'GB'
TABLES
eth_dats = l_it_dat.
In i_factid you have to pass factory Id like for india 'IN' or some other coutnry
n pass two dates you will get only working days in between those two dates
according to that calender
Regards,
Padmam.
06-26-2007 1:24 PM
Hi,
parameters: p_start type sy-datum,
p_end type sy-datum.
data: idays type table of rke_dat with header line.
data: workingdays type i.
call function 'RKE_SELECT_FACTDAYS_FOR_PERIOD'
exporting
i_datab = p_start
i_datbi = p_end
i_factid = 'P8' " Fact Calender ID
tables
eth_dats = idays
exceptions
date_conversion_error = 1
others = 2.
describe table idays lines workingdays.
write:/ workingdays.
Thanks,
06-26-2007 1:27 PM
Hi,
You may use FM DAY_ATTRIBUTES_GET for the same.
Regards
Raju Chitale
06-26-2007 1:27 PM
Hi,
Use the function module
WDKAL_DATE_ADD_FKDAYS
to get the No of working days between the date range.
and the function module,
WEEK_GET_NR_OF_WORKDAYS
try like the below
1. Independent PERFORM
for this purpose.
2. Using FM and logic
below is a FORM
which independelty
gives the NUMBER OF WORKING DAys
(inputs are : fromdate, todate, days)
eg. From 24-jan-2006
25-jan-2006
26-jan-2006 (republic day in india)
27-jan-2006
It will Return 3
3. see this code (just copy paste)
REPORT abc.
*----
DATA : days TYPE i.
DATA : dt TYPE sy-datum.
*----
SELECT-OPTIONS : mydate FOR sy-datum DEFAULT '20060124' TO '20060127'.
*----
START-OF-SELECTION.
PERFORM calcdays USING mydate-low mydate-high days.
WRITE days .
*----
FORM
*----
FORM calcdays USING fromdate todate days.
DATA : dt TYPE sy-datum.
dt = fromdate.
DO.
IF dt > todate.
EXIT.
ENDIF.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
date = dt
factory_calendar_id = 'IN'
message_type = 'I'
EXCEPTIONS
date_after_range = 1
date_before_range = 2
date_invalid = 3
date_no_workingday = 4
factory_calendar_not_found = 5
message_type_invalid = 6
OTHERS = 7.
dt = dt + 1.
IF sy-subrc = 0.
days = days + 1.
ENDIF.
ENDDO.
ENDFORM. "calcdays
Check the link answer given by rich
https://forums.sdn.sap.com/click.jspa?searchID=3460848&messageID=935342
<b>Reward points</b>
Regards
06-26-2007 1:28 PM
06-26-2007 1:29 PM
06-26-2007 1:30 PM