‎2007 Jul 31 2:39 PM
Hi !
I need to use a function that Abstract two dates and consider only working dates !
please help me to find that function.
Thanks
Moshe
‎2007 Jul 31 2:43 PM
hi,
U can use the below FM.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
DATE = SY-DATUM
FACTORY_CALENDAR_ID = '01'
MESSAGE_TYPE = 'E'
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.
IF
SY-SUBRC = 0.
WRITE 'working day'.
ELSE.
WRITE 'not workingday'.
ENDIF.<u>note</u>
You have to give '01' instead of '1' in factory calender.
Rgds
Reshma
‎2007 Jul 31 3:25 PM
Hi !
First thanks for your answer.
I need a FM that calculate the difference between two dates and in the difference
to consider only working dates?
Thanks
Moshe
‎2007 Aug 01 7:10 AM
Hi,
Please use this code, it can help you.
data : date1 type sy-datum,
date2 type sy-datum.
data : w_day(3),
nw_day(3).
date1 = '20070701'.
date2 = '20070731'.
Types : begin of ty_date,
date type sy-datum,
end of ty_date.
data : days type VTBBEWE-ATAGE, years type VTBBEWE-ATAGE, months type VTBBEWE-ATAGE.
data : a_new type sy-datum, b_new type sy-datum.
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
i_date_from = date1
I_KEY_DAY_FROM = '00'
i_date_to = date2
I_KEY_DAY_TO = '00'
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = days
E_MONTHS = months
E_YEARS = years.
days = days + 1.
do days times.
CALL FUNCTION 'DATE_CHECK_WORKINGDAY'
EXPORTING
DATE = date1
FACTORY_CALENDAR_ID = '01'
MESSAGE_TYPE = 'E'
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.
IF
SY-SUBRC = 0.
w_day = w_day + 1.
ELSE.
nw_day = nw_day + 1.
ENDIF.
date1 = date1 + '00000001'.
enddo.
WRITE : / 'Working Days :', w_day.
WRITE : / 'Non-working Days:', nw_day.
Reward points, if helpful,
Sandeep Kaushik