check start-date and end-date between periods entered
Hi all.
How to check that 2 dates (contract start-date and contract end-date) lies between 2 periods entered in the selection screen by user?
for example:
I have 2 periods : 04.2003 to 04.2004. I have contract data with validity period: 01.03.2003 to 01.05.2003.
My scenario:
as the contract's validity period lies between that period, contract have to be included.
Can anyone ever handle this matter? Please help me
*_*
Alia
Hi,
this logic should solve your problem -
period from <= contract end date and
period to >= contract start date.
regards
l
Hello,
You can use FMs FIRST_DAY_IN_PERIOD_GET to get the first day in the 'from' period and LAST_DAY_IN_PERIOD_GET to get the last day in the 'to' period.
You should then be able to use 'between' as part of a select statement where condition to get only records where the date is between these two values.
Regards,
Tim
This is an old topic but I've another solution. I didn't found any FM that help in my case. But this ABAP code works for me. It don't care about exclusion periods.
SELECT-OPTIONS : s_datum FOR t528b-begda.
data : l_begda type d,
l_endda type d.
....
....
loop at idata.
IF NOT ( idata-begda IN s_datum OR
idata-endda IN s_datum ).
l_begda = '99991231'.
l_endda = '19000101'.
LOOP AT s_datum WHERE sign = 'I'.
IF s_datum-low < l_begda.
MOVE s_datum-low TO l_begda.
ENDIF.
IF s_datum-high > l_endda.
MOVE s_datum-high TO l_endda.
ENDIF.
ENDLOOP.
CHECK idata-begda <= l_begda AND
idata-endda >= l_endda.
ENDIF.
...
endloop.