2009 Mar 19 3:24 PM
Do you know any function module which will give me the previous working day only by ignoring saturdays and sundays and it should NOT consider holidays.
Example:
Monday's Date should give me previous friday's date.
Friday's Date should give me previous thrusday's date
2009 Mar 19 3:37 PM
Hi,
To get the last day use FM 'RP_CALC_DATE_IN_INTERVAL'
and to check whether it was a working day you can use FM
call function 'DATE_CHECK_WORKINGDAY'
exporting
date = v_date
factory_calendar_id = 'FR'
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.
you need to pass the factory calendar accordingly, here the calendar if 'FR' for france working days, if sy-subrc is 4 then its not a working day.
Regards
Syed
2009 Mar 19 3:40 PM
check the table: TFACS which is the factory calendar display
2009 Mar 19 3:43 PM
DATA: date TYPE d,
i TYPE i.
date = '20090316'.
DO.
SUBTRACT 1 FROM date.
i = date MOD 7.
IF i > 1.
EXIT.
ENDIF.
ENDDO.
WRITE date.
Thomas
2009 Mar 19 3:47 PM
2009 Mar 19 3:54 PM
Hello Ramesh,
I assume you have your factory calendar ID with you:
DATA:
L_V_PREDT TYPE DATUM, "Next Day.
L_V_PREDT = SY-DATUM - 1.
* Get the next Working Day as per Factory Calendar
CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'
EXPORTING
CORRECT_OPTION = '-' " -VE to get the previous date
DATE = L_V_PREDT
FACTORY_CALENDAR_ID = 'HY' "--> Give your factory cal. ID here
IMPORTING
DATE = V_PREWD
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.
* Do Nothing
ENDIF.If you want to use the FM: BKK_GET_PRIOR_WORKDAY, still then you have to use the operation:
L_V_PREDT = SY-DATUM - 1.And pass L_V_PREDT to the FM. You can test with 23.03.2009 date & check )
Hope this helps.
BR,
Suhas
Edited by: Suhas Saha on Mar 19, 2009 4:56 PM
2009 Mar 25 7:13 PM