‎2007 May 16 9:23 AM
Hi,
Is there any function module to calculate the difference between two periods.
(I.e, period and year combinations)
‎2007 May 16 9:29 AM
Hi Karthick,
Use the FM "HR_99S_INTERVAL_BETWEEN_DATES".
Sample code,
DATA : DATE1 LIKE SY-DATUM,
DATE2 LIKE SY-DATUM,
DAYS1 TYPE I,
WEEKS1 TYPE I,
MONTHS1 TYPE I,
YEARS1 TYPE I,
AGE(30) TYPE C.
DATE1 = DOB.
DATE2 = SY-DATUM.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = DATE1
endda = DATE2
IMPORTING
DAYS = DAYS1
WEEKS = WEEKS1
MONTHS = MONTHS1
YEARS = YEARS1.
Thanks,
Reward If Helpful.
‎2007 May 16 9:25 AM
can't you do it manually...
if years are same...simply find the difference in the periods,
if not then first find the difference in the years and then the periods.
might be possible with a simple arithmetic calculation....try it?
please let me know if i have understood you horribly wrongly!!
regards,
Priyank
‎2007 May 16 9:28 AM
‎2007 May 16 9:28 AM
hi,
Use this FM.
CALL FUNCTION 'HR_MX_INTERVAL_BETWEEN_DATES'
EXPORTING
I_DATE_START = gd_start_date
I_DATE_END = gd_end_date
IMPORTING
E_YEARS = gd_years
E_DAYS = gd_days
EXCEPTIONS
SEQUENCE_OF_DATES_NOT_VALID = 1
ERROR_IN_CALC_OF_YEARS = 2
NO_ENTRY_IN_T511K = 3
OTHERS = 4.
if sy-subrc <> 0.
endif.Regards
Reshma
‎2007 May 16 9:29 AM
Hi Karthick,
Use the FM "HR_99S_INTERVAL_BETWEEN_DATES".
Sample code,
DATA : DATE1 LIKE SY-DATUM,
DATE2 LIKE SY-DATUM,
DAYS1 TYPE I,
WEEKS1 TYPE I,
MONTHS1 TYPE I,
YEARS1 TYPE I,
AGE(30) TYPE C.
DATE1 = DOB.
DATE2 = SY-DATUM.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = DATE1
endda = DATE2
IMPORTING
DAYS = DAYS1
WEEKS = WEEKS1
MONTHS = MONTHS1
YEARS = YEARS1.
Thanks,
Reward If Helpful.