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: 

Difference of two dates

Former Member
0 Kudos

Hi experts......

Could u please tell how to find out number of days between of two dates...the two dates should be of type sydatum...what are exact FM..i couldn't find the correct FM..so please help me to resolve this problem..

Thanks in advance..

Saleem

1 ACCEPTED SOLUTION

rainer_hbenthal
Active Contributor
0 Kudos

Please read forums rules first.

8 REPLIES 8

Former Member
0 Kudos

hi,

Function module: /SDF/CMO_DATETIME_DIFFERENCE

0 Kudos

just simply substract u will get no of days

rainer_hbenthal
Active Contributor
0 Kudos

Please read forums rules first.

Former Member
0 Kudos

Hi Saleem ,

Please use the following FM to get the diffence between two dates. let me know for any clarifications.

CALL FUNCTION 'C14B_DIFF_BT_2_DATES'
      EXPORTING
        i_date_from               = p_date
        i_date_to                 = lv_final_date
      IMPORTING
        e_days                    = lv_days
      EXCEPTIONS
        plausibility_check_failed = 1
        OTHERS                    = 2.

Regards

-


cb

0 Kudos

Hi,

You can use following FMs:

HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.

FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.

SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours.

HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months

Chk for the date format which you need and use the suitable FM.

Try searching the SDN b4 posting.

Hope this helps.

Regards,

Vaibhav

Former Member
0 Kudos

Hi,

Use /SDF/CMO_DATETIME_DIFFERENCE function module.

check link :-

http://wiki.sdn.sap.com/wiki/display/ABAP/FunctionModulerelatedonDate+calculations

Salil...

Former Member
0 Kudos

Hi Saleem

How about Function module 'HR_SEN_CALE_DAYS_DURATION'.

Regards,

Gaito

kesavadas_thekkillath
Active Contributor
0 Kudos

Please donot ask & answer basic questions.