cancel
Showing results for 
Search instead for 
Did you mean: 

how to get months between two months

Former Member
0 Kudos

Dear SAP Experts,

I want to get the list of months between two months.

for example,

from month (01.2014)

to month (06.2014)

result :

01.2014

02.2014

03.2014

04.2014

05.2014

06.2014

Please help me, how can I achieve above results

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

former_member206650
Active Participant
0 Kudos

hi Tariq,

can you write logic in the program...

E_MONTHS will give the months using FM FIMA_DAYS_AND_MONTHS_AND_YEARS

split the start and end date into variable lv_start_month ,lv_end_month ,lv_start_year,,lv_end_year

then

lv_year = e_months/12.

lv_remainder = e_months mod 12.

do (lv_year*12) times.

write:

lv_start_month,lv_start_year

lv_start_month = lv_start_month +1.

if lv_start_month =13.

lv_start_year = lv_start_year+1.

lv_start_month =0.

endif.

end do.

hope it helps....

Former Member
0 Kudos

Dear Vishnu,

Thanks for your help & support, I really appreciate.

Answers (1)

Answers (1)

former_member226203
Active Contributor
0 Kudos

Try using FM: FIMA_DAYS_AND_MONTHS_AND_YEARS.

Pass the start date(I_DATE_FROM) and end date(I_DATE_TO).

The export parameter E_MONTHS will give you the number of months between these two dates.

Former Member
0 Kudos

Dear Kalyan,

The above function module is not fulfilling my requirement.

Do you have any other way.

Regards,