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

calculate month

Former Member
0 Likes
1,107

hi

i lok for FM that do the next thing:

i have two date and i want to know how much month there are between those date

for example

01/2005 04/2006 (format mm/yyyy)

the answer will be 16 month

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
927

Hi,

Check these fm.

MONTHS_BETWEEN_TWO_DATES

MONTHS_BETWEEN_TWO_DATES_NEW

HR_99S_MONTHS_BETWEEN_DATES

HR_MONTHS_BETWEEN_TWO_DATES

Regards,

Senthil

Message was edited by: senthil kumar

hi

i lok for FM that do the next thing:

i have two date and i want to know how much month there are between those date

for example

01/2005 04/2006 (format mm/yyyy)

the answer will be 16 month

thanks

5 REPLIES 5
Read only

Former Member
0 Likes
927

HI,

Use FM MONTHS_BETWEEN_TWO_DATES_NEW

Best regards,

Prashant

Read only

Former Member
0 Likes
928

Hi,

Check these fm.

MONTHS_BETWEEN_TWO_DATES

MONTHS_BETWEEN_TWO_DATES_NEW

HR_99S_MONTHS_BETWEEN_DATES

HR_MONTHS_BETWEEN_TWO_DATES

Regards,

Senthil

Message was edited by: senthil kumar

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
927

Hi,

Use F.M

<b>MONTHS_BETWEEN_TWO_DATES_NEW</b>

to get the months between two dates..

Cheers,

Simha.

Read only

Former Member
0 Likes
927

Check this code it may help u.

parameters:date1 like sy-datum,

date2 like sy-datum.

data:mon(10) type c.

CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = date1

i_datum_von = date2

  • I_KZ_INCL_BIS = ' '

IMPORTING

E_MONATE = mon.

.

Regards

Read only

Former Member
0 Likes
927

hi yossi,

DATA : v_no_months type i.

DATA : v_date_low like sy-datum,

v_date_high like sy-datum.

v_date_low = s_date-low

v_date_high = s_date-high

CALL FUNCTION 'MONTHS_BETWEEN_TWO_DATES'

EXPORTING

i_datum_bis = v_date_low

i_datum_von = v_date_high

IMPORTING

e_monate = v_no_months.

v_no_months : will give u the number of months.

hope this helps,

do reward if it helps,

priya.