10-06-2009 1:36 PM
Hi All,
I want to get number of working days in a date range for the given factory calendar. please provide me if there any function module which gives the above details.
Thanks,
Shiva
Edited by: Shiva on Oct 6, 2009 2:36 PM
10-06-2009 1:50 PM
Hi
check this funcation modules.
CBIH_LB18_WORKDAYS_READ
RH_REQUEST_ON_WORKINGDAYS
HRWPC_PCR_CHECK_WORKINGDAYS
WLB3_GET_NUMBER_OF_WORKDAYS
K_ABC_WORKDAYS_FOR_PERIODS_GET
10-06-2009 1:55 PM
Hi Shiva,
Refer these belwo links... It might be of use for your requirement.
https://wiki.sdn.sap.com/wiki/display/ABAP/UsefulABAPFunction+Modules
https://wiki.sdn.sap.com/wiki/display/ABAP/ImportantFunctionModule+Names
Thanks,
Harini
10-06-2009 1:57 PM
Hi try this way...
use fm to get the given day is working day or not 'DATE_CONVERT_TO_FACTORYDATE'
data: l_date like sy-datum,
l_end_date like sy-datum,
l_factory_date like sy-datum.
* Set L_DATE to the earlier date and L_END_DATE to the later date
if date_from <= date_to.
l_date = date_from.
l_end_date = date_to.
else.
l_date = date_to.
l_end_date = date_from.
endif.
days = 0.
* Test all days between the two dates, and count just the factory days
while l_date <= l_end_date.
* Determine if L_DATE is a factory date
call function 'DATE_CONVERT_TO_FACTORYDATE'
exporting
date = l_date
correct_option = '+'
factory_calendar_id = factory_calendar_id
importing
date = l_factory_date
exceptions
calendar_buffer_not_loadable = 1
correct_option_invalid = 2
date_after_range = 3
date_before_range = 4
date_invalid = 5
factory_calendar_not_found = 6
others = 7.
if sy-subrc = 0.
if l_date = l_factory_date.
days = days + 1.
endif.
l_date = l_date + 1.
endif.
endwhile.
if date_from > date_to.
days = days * -1.
endif.
the return days in nothing but the difference Number of Working days for the given factory calendar in given date range.
Prabhudas
10-06-2009 2:06 PM
Hi Shiva,
You can use the FM 'WLB3_GET_NUMBER_OF_WORKDAYS' to get the no. of working days for the given factory calender