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

Difference of two dates

Former Member
0 Likes
1,182

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
Read only

rainer_hbenthal
Active Contributor
0 Likes
1,112

Please read forums rules first.

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,112

hi,

Function module: /SDF/CMO_DATETIME_DIFFERENCE

Read only

0 Likes
1,112

just simply substract u will get no of days

Read only

rainer_hbenthal
Active Contributor
0 Likes
1,113

Please read forums rules first.

Read only

Former Member
0 Likes
1,112

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

Read only

Former Member
0 Likes
1,112

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

Read only

Former Member
0 Likes
1,112

Hi,

Use /SDF/CMO_DATETIME_DIFFERENCE function module.

check link :-

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

Salil...

Read only

Former Member
0 Likes
1,112

Hi Saleem

How about Function module 'HR_SEN_CALE_DAYS_DURATION'.

Regards,

Gaito

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,112

Please donot ask & answer basic questions.