Skip to Content
0
Former Member
Feb 17, 2009 at 01:37 PM

Date comparision while reading from infotypes date.

28 Views

Dear freinds,

I have one particular problem relating to the date comparison , The requirement is in a month i have to check the no of records which are matching in the infotype 2001 and check if any body is absence in that particular month.

I am not able to get correct records , as the logic went wrong in fetching the records from 2001.

on the selection screen i will be passing a particular month( eg feb 2009) i will have four weeks ,

so now i want to check in first week (01-02-2009 to 07-02-2009) against the record in the 2001 infotpe

as which is having a record from 09-02-2009 to 28-02-2009 for a particular leave.

my internal table (IT_DATES) will be having all the four week dates (

first week (01-02-2009 to 07-02-2009)

second week (08-02-2009 to 14-02-2009)

thirdweek (15-02-2009 to 21-02-2009)

fourthweek (22-02-2009 to 28-02-2009))

loop at it_dates into wa_dates

loop at p2001 into wa_p2001 where pernr = pernr-pernr

begda le wa_dates-begindate

endda ge wa_dates-enddate

endloop.

endloop.

in the above case we can see the second week record will hold good but it is not working as the

begda of 2001 record is not less than the dates in my internal table (08-02-2009 to 14-02-2009)

but the endda is in the range,

now the third week (15-02-2009 to 21-02-2009) and fourthweek is working as per code.

how can i get the second week record ?.

regards

srini