Skip to Content
author's profile photo Former Member
Former Member

how to get months between two months

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,

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jun 03, 2014 at 12:37 PM

    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....

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 03, 2014 at 10:30 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.