<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Leap year issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021037#M1168352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using any of these function modules LEAP_DAYS_BETWEEN_TWO_DATES' or FIMA_LEAP_DAYS_BETWEEN_2_DATES. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or try using this simple logic to find if a date is leap or not..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: date1 TYPE d. &lt;/P&gt;&lt;P&gt;date1 = '20040301'. &lt;/P&gt;&lt;P&gt;date1 = date1 - 1. &lt;/P&gt;&lt;P&gt;IF date1+6(2) = '29'. &lt;/P&gt;&lt;P&gt;  WRITE 'A leap year'. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;  WRITE 'No leap year'. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vasavi Kotha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Jan 2009 11:57:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-07T11:57:54Z</dc:date>
    <item>
      <title>Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021032#M1168347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem in one of the existing codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The cancellation amount is calculated for a range of dates.&lt;/P&gt;&lt;P&gt;Say the active line item has a start date of  01.03.2006 and end date of  01.03.2012 say (B).&lt;/P&gt;&lt;P&gt;Now if a rejection/Cancellation is put on date 01.05.2007 (A), the current program is calculating a value &lt;/P&gt;&lt;P&gt;based on the diffrence of days (B - A).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then this cancelled amnt =  the no of cancelled days * (a constn value * 12 / 365).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to modify my logic in such a way that the leap is also accounted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use the same dates , i realise that 2008 is the leap yr.&lt;/P&gt;&lt;P&gt;So how can i modify my calculation for the range if it contains a leap yr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest something on this, as it will be really helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sapna Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 11:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021032#M1168347</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T11:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021033#M1168348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sapna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of using the B-A concept for calculating the date difference use the function module     "     /SDF/CMO_DATETIME_DIFFERENCE   "  which gives the difference between two dates and this also takes the leap year into consideration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Madhu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 11:48:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021033#M1168348</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T11:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021034#M1168349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use this function module.&lt;/P&gt;&lt;P&gt;/SAPNEA/JSC_LEAP_YEAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 11:50:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021034#M1168349</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T11:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021035#M1168350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this: HR_99S_INTERVAL_BETWEEN_DATES &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer: &lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="5124708"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 11:51:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021035#M1168350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T11:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021036#M1168351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    you can use the FM HR_HK_DIFF_BT_2_DATES with output_format  = '02' to get the difference between dates in days.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 11:53:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021036#M1168351</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T11:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021037#M1168352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using any of these function modules LEAP_DAYS_BETWEEN_TWO_DATES' or FIMA_LEAP_DAYS_BETWEEN_2_DATES. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or try using this simple logic to find if a date is leap or not..&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: date1 TYPE d. &lt;/P&gt;&lt;P&gt;date1 = '20040301'. &lt;/P&gt;&lt;P&gt;date1 = date1 - 1. &lt;/P&gt;&lt;P&gt;IF date1+6(2) = '29'. &lt;/P&gt;&lt;P&gt;  WRITE 'A leap year'. &lt;/P&gt;&lt;P&gt;ELSE. &lt;/P&gt;&lt;P&gt;  WRITE 'No leap year'. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Vasavi Kotha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 11:57:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021037#M1168352</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T11:57:54Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021038#M1168353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sapna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use link:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1494099"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Tarun Gambhir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 12:03:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021038#M1168353</guid>
      <dc:creator>I355602</dc:creator>
      <dc:date>2009-01-07T12:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021039#M1168354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the response on my issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The leap year is not the only issue I am facing.&lt;/P&gt;&lt;P&gt;The calculation discussed:&lt;/P&gt;&lt;P&gt;then this cancelled amnt =  the no of cancelled days * (a constn value * 12 / 365).&lt;/P&gt;&lt;P&gt;Will also need a change now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because if the the division by 365 will be now 366 for a leap year.&lt;/P&gt;&lt;P&gt;But if this is for a range of 2 or 3 yrs in which 1 yr is a leap yr and the other 2 are non leap yrs, then how can i do the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 12:09:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021039#M1168354</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T12:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Leap year issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021040#M1168355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sapna,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    try to use the FM /SDF/CMO_DATETIME_DIFFERENCE, it will take care of the leap year, just pass the two dates for which you want the difference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
 EXPORTING
   DATE1                   = s_date
*   TIME1                  =
   DATE2                   = e_date
*   TIME2                  =
 IMPORTING
   DATEDIFF                = DATEDIFF
*   TIMEDIFF               =
*   EARLIEST               =
 EXCEPTIONS
   INVALID_DATETIME        = 1
   OTHERS                  = 2

IF sy-subrc &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the gap is for more one year than you have to do the calculation year wise only, in this case use the fm '/SAPNEA/JSC_LEAP_YEAR' that which year is a leap year. And than go for a IF condition while calculating either it should be 365 or 366 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 12:26:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/leap-year-issue/m-p/5021040#M1168355</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T12:26:09Z</dc:date>
    </item>
  </channel>
</rss>

