cancel
Showing results for 
Search instead for 
Did you mean: 

function module to find no of days between two dates

Former Member
0 Kudos

hi everybody i want a function module to find no of days between two dates

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member

Hi. You can use function module HR_99S_INTERVAL_BETWEEN_DATES. If you just want the number of days, you can use code like below:

DATA ws_begin_date type sy-datum.

DATA ws_end_date type sy-datum.

DATA days_between type i.

CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'

EXPORTING

begda = ws_begin_date

endda = ws_end_date

IMPORTING

days = days_between.

I hope this helps.

- April King

Former Member
0 Kudos

Try FM WFCS_FCAL_WDAYS_GET_S

Former Member
0 Kudos

Hi Ankit,

You can use following function moduled to get number of days:

1. CONVERT_DATE_TO_INTERNAL- Used to convert DD.MM.YYYY format date to YYYYMMDD format

2. HR_99S_INTERVAL_BETWEEN_DATES- Used to get days where input date should be in YYYYMMDD format.

Regards,

Sudeesh Soni


Former Member
0 Kudos

Function module /SDF/CMO_DATETIME_DIFFERENCE

Uppercase/Lowercase

Runtime: 59,629 Microseconds

Import parameters Value

DATE1 01.01.2007

TIME1 00:00:00

DATE2 31.12.2007

TIME2 00:00:00

Export parameters Value

DATEDIFF 364 TIMEDIFF 0

EARLIEST 1

amit_khare
Active Contributor
0 Kudos

Refer the FMs -

SD_DATETIME_DIFFERENCE

C14B_DIFF_BT_2_DATES

But easiest is -

data: v_dat type dats,

v_dat1 type dats,

v_int type I.

v_dat = sy-datum.

v_dat1 = sy-datum - 10.

v_int = v_dat - v_dat1.

write: v_int.

Regards,

Amit

Former Member
0 Kudos

/SDF/CMO_DATETIME_DIFFERENCE

check this

Former Member
0 Kudos

HR_HK_DIFF_BT_2_DATES check this FM

Former Member
0 Kudos

this function module is not working can u show me with an example how it works

Former Member
0 Kudos

which functional module??