‎2008 Jan 25 5:16 AM
Hi All,
could anybody tell me which Function Module can be used to get the number of days by giving two dates.
for ex: suppose if i will substract 04.01.2008 - 03.01.2008 = 1 day.
Please reply ASAP.
Thanks,
Madhu
‎2008 Jan 25 5:19 AM
Hi Madhu
You can simpy use the subtraction operator between two date fields types to get the numbe rof days.
Regards
Ranganath
PS : Reward points for all useful answers.
‎2008 Jan 25 5:27 AM
I think you just used below codes is ok,
data: l_diff type p.
l_diff = date1 - date2.
If you really want to use the FM, please check the FM:SD_DATETIME_DIFFERENCE.
‎2008 Jan 25 5:51 AM
‎2008 Jan 25 9:29 PM
‎2008 Jan 25 9:40 PM
Hello,
Check this sample:
DATA: G_F_DIFF TYPE I.
CLEAR G_F_DIFF.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
I_DATUM_BIS = ENDATE
I_DATUM_VON = STARTDATE
IMPORTING
E_TAGE = G_F_DIFF
EXCEPTIONS
DAYS_METHOD_NOT_DEFINED = 1
OTHERS = 2.
Cheers,
Vasanth
Edited by: Vasanth M on Jan 25, 2008 10:41 PM