‎2008 Jul 16 11:34 AM
hi all,
whats the function module used to calculate the difference
between two dates
regards
Suprith
‎2008 Jul 16 11:36 AM
‎2008 Jul 16 11:36 AM
‎2008 Jul 16 11:37 AM
‎2008 Jul 16 11:37 AM
‎2008 Jul 16 11:37 AM
‎2008 Jul 16 11:38 AM
‎2008 Jul 16 11:39 AM
Hi Kumar,
try the FM:
SD_DATETIME_DIFFERENCE
Give the difference in Days and Time for 2 dates
and for more FM's visit the link:
http://www.erpgenie.com/abap/functions.htm
with luck,
Pritam.
‎2008 Jul 16 11:40 AM
Hi,
You can use function module FIMA_DAYS_AND_MONTHS_AND_YEARS or
also please go through /SDF/CMO_DATETIME_DIFFERENCE
for date difference.
‎2008 Jul 16 11:41 AM
Hi Suprit,
Check this function module:
SD_DATETIME_DIFFERENCE
This gives the difference in Days and Time for 2 dates
Hope this helps you.
Regards,
Chandra Sekhar
‎2008 Jul 16 11:41 AM
Hi Suprith.
I would like to suggest a couple of them,
DAYS_BETWEEN_TWO_DATES
FIMA_DAYS_BETWEEN_TWO_DATES
FIMA_DAYS_BETWEEN_TWO_DATES_2
I would also like to suggest a few references,
[SDN - Reference for Difference between two dates - Function module with source code|;
[SDN - Reference for calculating difference between two dates - Source code|;
Hope that's usefull.
Good Luck & Regards.
Harsh Dave
‎2008 Jul 16 11:44 AM
HI,
Please use FM DAYS_BETWEEN_TWO_DATES to get the difference in daysa and MONTHS_BETWEEN_TWO_DATES to get the difference in months.
Thanks,
Sriram Ponna.
‎2008 Jul 16 11:51 AM
Hi,
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_start
i_datum_von = p_end
IMPORTING
e_tage = diff
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2.
WRITE:/ diff.
-
Check the following code:
REPORT ZDATEDIFF.
DATA: EDAYS LIKE VTBBEWE-ATAGE,
EMONTHS LIKE VTBBEWE-ATAGE,
EYEARS LIKE VTBBEWE-ATAGE.
PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,
TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.
call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
exporting
i_date_from = FROMDATE
i_date_to = TODATE
I_FLG_SEPARATE = ' '
IMPORTING
E_DAYS = EDAYS
E_MONTHS = EMONTHS
E_YEARS = EYEARS.
WRITE:/ 'Difference in Days ', EDAYS.
WRITE:/ 'Difference in Months ', EMONTHS.
WRITE:/ 'Difference in Years ', EYEARS.
INITIALIZATION.
FROMDATE = SY-DATUM - 60.
-
or u may need this in certain cases
Btw, the tmp_date was to manipulate the dates in such a way to see the p_start is greater than p_end.
if p_start < p_end.
tmp_date = p_end.
p_end = p_start.
p_start = p_end.
endif.
Even we have HR_HK_DIFF_BT_2_DATES function module.
Hope this helps.
plz reward if useful.
thanks,
dhanashri.