Application Development 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: 

what is the function module to difference between two date

Former Member
0 Kudos

Hi,

I need to know what is the function module that is used to find the difference between two dates.

Regards,

Clara

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi clara/cheli!

Use Function module SD_DATETIME_DIFFERENCE to get the result.

G.Prasanna Kumar

reward points if helpful

Message was edited by: Praneeth kumar

6 REPLIES 6

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi clara/cheli!

Use Function module SD_DATETIME_DIFFERENCE to get the result.

G.Prasanna Kumar

reward points if helpful

Message was edited by: Praneeth kumar

Former Member
0 Kudos

hi ,

try these fms..

SD_DATETIME_DIFFERENCE

DAYS_BETWEEN_TWO_DATES

MONTHS_BETWEEN_TWO_DATES..

<b>reward if useful..</b>

Former Member
0 Kudos

hi,

For finding the difference between two dates, there is no need of function module. We can get it by just simple subtraction.

data:

date1 like sy-datum,

date2 like sy-datum.

v_diff = date1 - date2.

Please find the link

Here you can find the function modules with examples.

Regards,

Sailaja.

former_member188685
Active Contributor
0 Kudos

hi Clara,

why do you need FM for that..

data: date1 type sy-datum,
      date2  type sy-datum.

data: diff type i.

diff = date1 - date2.

Regards

vijay

Former Member
0 Kudos

Hi,

SD_DATETIME_DIFFERENCE- to find the difference between two dates.

Regards,

Varma