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

How to get number of periods between given range

Hi,

I am developing a program to insert new data into S716 table based on each period. The period range as given as input example 09/2005 to 02/2006. I have update the data for all the periods between the given range.

Is there any function module to get the no. of periods or a better logic to do this. pls help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 12:58 PM

    Hi Gopal,

    1) Adding 01(day) to the second dates date and pass that to <b>RE_LAST_DAY_OF_MONTH or SLS_MISC_GET_LAST_DAY_OF_MONTH</b>. You will get the last date of that month(w_seconddate). Adding 01 will make first date(w_firstdate)

    Then Days = w_seconddate - w_firstdate will give you the days.

    Hope this helps you.

    ~thomas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 01:03 PM

    HI,

    Check the FM... "RKE_GET_NUMBER_OF_PERIODS".

    Thanks and Regards,

    Bharat Kumar Reddy.V

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 01:16 PM

    Hi,

    Go thru this link

    http://www.erpgenie.com/abap/functions.htm

    Thanks

    Sunil

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 29, 2006 at 01:27 PM

    Hi,

    Sample code for the function module you want.

    REPORT ZDATEDIFF.

    DATA: EDAYS LIKE VTBBEWE-ATAGE,

    EMONTHS LIKE VTBBEWE-ATAGE,

    EYEARS LIKE VTBBEWE-ATAGE.

    PARAMETERS: FROMDATE LIKE VTBBEWE-DBERVON,

    TODATE LIKE VTBBEWE-DBERBIS DEFAULT SY-DATUM.

    call function 'FIMA_DAYS_AND_MONTHS_AND_YEARS'

    exporting

    i_date_from = FROMDATE

    i_date_to = TODATE

    • I_FLG_SEPARATE = ' '

    IMPORTING

    E_DAYS = EDAYS

    E_MONTHS = EMONTHS

    E_YEARS = EYEARS.

    WRITE:/ 'Difference in Days ', EDAYS.

    WRITE:/ 'Difference in Months ', EMONTHS.

    WRITE:/ 'Difference in Years ', EYEARS.

    INITIALIZATION.

    FROMDATE = SY-DATUM - 60.

    Regards,

    anver

    pls mark all hlpful answers

    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.