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

Any Function Module to find Difference between two Monyr's

Former Member
0 Likes
926

Hello friends,

Is there any Function Module to find the difference between

two Monyr Variables

For.Eg Difference

between 01.2008 & 11.2007 = 2.

4 REPLIES 4
Read only

Former Member
0 Likes
646

Check out this related thread ... hope it helps ..

Read only

vinod_vemuru2
Active Contributor
0 Likes
646

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.

Read only

Former Member
0 Likes
646

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.

Read only

Former Member
0 Likes
646

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