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

Function Module to get days by putting input dates

Former Member
0 Likes
599

Hi All,

could anybody tell me which Function Module can be used to get the number of days by giving two dates.

for ex: suppose if i will substract 04.01.2008 - 03.01.2008 = 1 day.

Please reply ASAP.

Thanks,

Madhu

5 REPLIES 5
Read only

Former Member
0 Likes
578

Hi Madhu

You can simpy use the subtraction operator between two date fields types to get the numbe rof days.

Regards

Ranganath

PS : Reward points for all useful answers.

Read only

former_member249594
Participant
0 Likes
578

I think you just used below codes is ok,

data: l_diff type p.

l_diff = date1 - date2.

If you really want to use the FM, please check the FM:SD_DATETIME_DIFFERENCE.

Read only

Former Member
0 Likes
578

Hi,

Use FM /SDF/CMO_DATETIME_DIFFERENCE

Read only

Former Member
0 Likes
578

hi

look this fm HR_99S_INTERVAL_BETWEEN_DATES

Regards

Gregory

Read only

Former Member
0 Likes
578

Hello,

Check this sample:


DATA: G_F_DIFF TYPE I.

CLEAR G_F_DIFF.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
I_DATUM_BIS = ENDATE
I_DATUM_VON = STARTDATE 
IMPORTING
E_TAGE = G_F_DIFF
EXCEPTIONS
DAYS_METHOD_NOT_DEFINED = 1
OTHERS = 2.

Cheers,

Vasanth

Edited by: Vasanth M on Jan 25, 2008 10:41 PM