‎2008 Mar 23 4:32 AM
Hello friends,
Is there any Function Module to find the difference between
two Monyr Variables
For.Eg Difference
between 01.2008 & 11.2007 = 2.
‎2008 Mar 23 4:39 AM
‎2008 Mar 23 6:30 AM
Hi Hari,
I am not sure of any FM available for this requirement. But u can write a simple code and use FM HR_99S_INTERVAL_BETWEEN_DATES for getting difference in months. Check below logic
DATA: p1(7) TYPE c VALUE '01.2008',
p2(7) TYPE c VALUE '11.2007',
w_date1 TYPE d,
w_date2 TYPE d,
w_result TYPE i.
CONCATENATE:p13(4) p10(2) '01' INTO w_date1,
p23(4) p20(2) '01' INTO w_date2.
CALL FUNCTION 'HR_99S_INTERVAL_BETWEEN_DATES'
EXPORTING
BEGDA = w_date2
endda = w_date1
TAB_MODE = ' '
IMPORTING
DAYS =
C_WEEKS =
C_MONTHS = w_result
C_YEARS =
WEEKS =
MONTHS =
YEARS =
D_MONTHS =
MONTH_TAB =
.
WRITE w_result.
Now u will get difference in months in the importing parameter c_months/d_months.
Thanks,
Vinod.
‎2008 Mar 23 7:08 AM
Hi,
Without the day we cant calculate the difference. So make the day as 01 in both the inputs and use the function module as RTP_US_API_DATES_TO_AGE. Hope your expected output will be produced.
Reward points if useful.
Regards,
Sankar.
‎2008 Mar 23 8:30 AM
The below Function Modules are helpfull
CMO_DATETIME_DIFFERENCE Calculates difference between two dates/timestamps.
CMO_TIME_DIFF_GET Calculate the time difference in seconds
HR_HK_DIFF_BT_2_DATES HR-HK: Calculate the days, months and years between 2 dates.
HR99L00_GET_RETRO_MONTH_DIFF Get retroactive result differences by month
HR_PDC_CALCULATE_TIME_DIFF
SCSM_TIME_DIFF_GET