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

DATE filed Operations....

hi friends,

When I subtract date1 from date2 I need no. of days and no. of months and no. of years.

Example (1):

date1 : 12.08.2005

date2 : 22.08.2005

answer should be like this. (date2 minus date1)

Days : 10

Months : 0

Years: 0

thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 23, 2005 at 11:04 AM

    use FM

    FIMA_DAYS_AND_MONTHS_AND_YEARS

    just pass i_date_from and i_date_to

    Regards

    Raja

    Message was edited by: Durairaj Athavan Raja

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      then it will be this

      DATA: dat1 like sy-datum value '20030722',

      dat2 like sy-datum value '20050310',

      day_nr type i,

      mon_nr type i,

      yr_nr type i.

      day_nr = abs( dat26(2) - dat16(2) ).

      mon_nr = abs( dat24(2) - dat14(2) ).

      yr_nr = abs( dat20(4) - dat10(4) ).

      write: / 'day(s): ',day_nr.

      write: / 'month(s): ', mon_nr.

      write: / 'year(s): ', yr_nr.

      Message was edited by: Peter van Alphen

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.