Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

date function module

Former Member
0 Likes
1,486

hi all,

whats the function module used to calculate the difference

between two dates

regards

Suprith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,428

try this function : 'HR_SGPBS_YRS_MTHS_DAYS'

11 REPLIES 11
Read only

Former Member
0 Likes
1,429

try this function : 'HR_SGPBS_YRS_MTHS_DAYS'

Read only

Former Member
0 Likes
1,427

Dear,

C14B_DIFF_BT_2_DATES

Regards,

Read only

Former Member
0 Likes
1,427

hi,

Try this FM

HR_HK_DIFF_BT_2_DATES

Regards

Sumit Agarwal

Read only

Former Member
0 Likes
1,427

Hi,

try this FM HR_HK_DIFF_BT_2_DATES

Read only

Former Member
0 Likes
1,427

Hello

HR_HK_DIFF_BT_2_DATES

Read only

Former Member
0 Likes
1,427

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.

Read only

Former Member
0 Likes
1,427

Hi,

You can use function module FIMA_DAYS_AND_MONTHS_AND_YEARS or

also please go through /SDF/CMO_DATETIME_DIFFERENCE

for date difference.

Read only

Former Member
0 Likes
1,427

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

Read only

Former Member
0 Likes
1,427

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

Read only

Former Member
0 Likes
1,427

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.

Read only

Former Member
0 Likes
1,427

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.