‎2008 Aug 19 3:21 PM
hi,
i want to know the function modules which give
1.no.days between two given dates
2.no.months between two given dates
3.no.years between two gives dates
thanks in advance.
‎2008 Aug 19 3:26 PM
You may want to try and Search this Forum, as this has been asked several times. I did a Search on "Days Between" and found 103 hits.
‎2008 Aug 19 3:26 PM
You may want to try and Search this Forum, as this has been asked several times. I did a Search on "Days Between" and found 103 hits.
‎2008 Aug 19 3:28 PM
Kiran,
just give appropriate term in se37 with wild char and press F4 you will get many FM use either among them.
like daybetween* press F4 and all possible term.
Amit.
‎2008 Aug 19 6:38 PM
‎2008 Aug 19 6:51 PM
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
RP_CALC_DATE_IN_INTERVAL
Add/subtract years/months/days from a date
‎2008 Aug 20 4:34 AM
Hi kiran,
You can use the FM HR_GET_TIME_BETWEEN_DATES to get months,years and days between two dates.
Example:-
data :
w_days type p,
w_months type p,
w_years type p.
CALL FUNCTION 'HR_GET_TIME_BETWEEN_DATES'
EXPORTING
beg_date = fs_day-f_day
end_date = fs_day-l_day
IMPORTING
months = w_months
days = w_days
years = w_years
EXCEPTIONS
invalid_period = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. " IF SY-SUBRC <> 0This will definitely solve your issue.
Best of luck,
Bhumika
‎2008 Aug 20 9:17 AM
This FM will give you all you need
HR_99S_INTERVAL_BETWEEN_DATES
Regards,
Prashant
‎2008 Aug 20 2:17 PM
1) To get the number of months between the two dates.
use function mod
MONTHS_BETWEEN_TWO_DATES
2) To get the number of days between the two dates
Check the Fun Mod
SD_DATETIME_DIFFERENCE and
RP_CALC_DATE_IN_INTERVAL
3) To get the number of weeks between the two dates
check fun mod
HR_IE_NUM_PRSI_WEEKS
4) To get the number of years between the two dates
check fun mod
HR_HK_DIFF_BT_2_DATES
Regards
srinivas
‎2008 Aug 26 1:04 PM
hi,
you can use these fm .
RP_CALC_DATE_IN_INTERVAL
HR_IE_NUM_PRSI_WEEKS
‎2008 Aug 27 7:21 AM
Hi..
Please use the FM HRCO_GET_TIME_BETWEEN_DATES ..
I think it will solve ur problems..
DATA: v_date1 TYPE sy-datum,
v_date2 TYPE sy-datum,
v_days TYPE P,
v_month TYPE p,
v_year TYPE p.
v_date1 = sy-datum.
v_date2 = '20100826'.
CALL FUNCTION 'HRCO_GET_TIME_BETWEEN_DATES'
EXPORTING
beg_date = v_date1
end_date = v_date2
IMPORTING
DAYS = v_days
MONTHS = v_month
YEARS = v_year
EXCEPTIONS
INVALID_PERIOD = 1
OTHERS = 2
.
IF sy-subrc = 0.
WRITE : / v_days, v_month, v_year.
ENDIF.
‎2008 Aug 27 10:11 AM
Hi ,
hope dis is use full for u..................
HR_GET_TIME_BETWEEN_DATES
HR_99S_INTERVAL_BETWEEN_DATES
Regard's
Shaik.
‎2008 Aug 27 11:21 AM
Run this report. This will exactly match your requirement.
I searched this from the net. copy the code and check in your system by giving two inputs start date and end date to calculated no of days,months and year
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.
‎2008 Aug 27 12:36 PM
Hi Kiran,
Try this FM's:
SD_DATETIME_DIFFERENCE
Give the difference in Days and Time for 2 dates
HR_IE_NUM_PRSI_WEEKS
Return the number of weeks between two dates.
RP_CALC_DATE_IN_INTERVAL
Add/subtract years/months/days from a date
With luck,
Pritam.