<?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: DURATION_DETERMINE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505794#M1259306</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using following function module.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SD_CALC_DURATION_FROM_DATETIME&lt;/STRONG&gt; : Find the difference between two date/time and report the difference in hours&lt;/P&gt;&lt;P&gt;These hours you can convert in whatever you want days, weeks, months and so on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;L_MC_TIME_DIFFERENCE&lt;/STRONG&gt; : Find the time difference between two date/time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Apr 2009 18:15:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-11T18:15:44Z</dc:date>
    <item>
      <title>DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505793#M1259305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was looking at this fm DURATION_DETERMINE and it doesnt seem to be returning the correct value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I put in:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Import parameters               Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; UNIT                            DY&lt;/P&gt;&lt;P&gt; FACTORY_CALENDAR                Z1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Changing parameters             Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; START_DATE                      03/02/2009&lt;/P&gt;&lt;P&gt;                  Result:        03/02/2009&lt;/P&gt;&lt;P&gt; START_TIME                      00:00:00&lt;/P&gt;&lt;P&gt;                  Result:        00:00:00&lt;/P&gt;&lt;P&gt; END_DATE                        03/09/2009&lt;/P&gt;&lt;P&gt;                  Result:        03/05/2009&lt;/P&gt;&lt;P&gt; END_TIME                        00:00:00&lt;/P&gt;&lt;P&gt;                  Result:        24:00:00&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Export parameters               Value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DURATION                     4.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, shouldn't I be getting a value of 5?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because the number of days include March 3rd, 4th, 5th, 6th and 9th.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like it is taking 3/9 and transforming it to 3/5 for some reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Should I be using different input variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 17:29:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505793#M1259305</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T17:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505794#M1259306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using following function module.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SD_CALC_DURATION_FROM_DATETIME&lt;/STRONG&gt; : Find the difference between two date/time and report the difference in hours&lt;/P&gt;&lt;P&gt;These hours you can convert in whatever you want days, weeks, months and so on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;L_MC_TIME_DIFFERENCE&lt;/STRONG&gt; : Find the time difference between two date/time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 18:15:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505794#M1259306</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T18:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505795#M1259307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Lalit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using that Fm because I need mdays (manufacturing days) so Saturday / Sundays don't count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have fm SD_CALC_DURATION_FROM_DATETIME in my system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other advise?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 19:47:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505795#M1259307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T19:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505796#M1259308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;when I change the input from z1 to z2 it calculates correctly. Given my example I now have 5 mdays!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Apr 2009 20:17:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505796#M1259308</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-11T20:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505797#M1259309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There possible reason why you are getting 4 would that the FM does not include the end date.&lt;/P&gt;&lt;P&gt;Try out with few more examples and see if you get the same kind of result.&lt;/P&gt;&lt;P&gt;If yes then you can add 1 to get the date including end date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Lalit Mohan Gupta.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Apr 2009 03:57:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505797#M1259309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-12T03:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505798#M1259310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For all who stumbled from search over this thread:&lt;BR /&gt;Don`t use this function module!!!! It doesn`t return correct values. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had a case to calculate the years between 01.10.1992 and 30.06.2015. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It`s obvious that the result has to be 22.75 but the function module returns 22.76. &lt;BR /&gt;Even when I was "playing" with including/excluding start and end days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you count months it`s exactly 22.75. If you count days its 22.7479....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 12:34:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505798#M1259310</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-11-14T12:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505799#M1259311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it didn't work did you turn in a sap msg to get it fixed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 16:26:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505799#M1259311</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-11-14T16:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505800#M1259312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;no I didn`t - fix was urgent, because report is already productive. I did an own function which calculates correct &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/1925/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This issue is&amp;nbsp; obviously and I suppose SAP knows about. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 09:25:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505800#M1259312</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-11-15T09:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505801#M1259313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dieter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the time calculation for YR (Year) gives not the result you want. The function module together with the customizing in table t006 defines a year to be exact 365 days long.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start date&amp;nbsp; January 1st.2013 00:00:01 end date January 1st.2014 00:00:01: The function returns 1&lt;/P&gt;&lt;P&gt;Start date&amp;nbsp; January 1st.2014 00:00:01 end date January 1st.2015 00:00:01: The function returns 1.00273 (= 366/365)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason is, 2014 has a leap day, February 29th 2014.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You expect:&lt;/P&gt;&lt;P&gt;Start date&amp;nbsp; January 1st.2014 00:00:01 end date January 1st.2015 00:00:01: The function shall return 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is also something a customer can expect. But it is a different definition of a year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is therefor no known error in the function module. The problem is, that time differences like year or month are often used, but often without defining exactly how it shall be calculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards&lt;/P&gt;&lt;P&gt;Rainer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 09:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505801#M1259313</guid>
      <dc:creator>rainer_winkler</dc:creator>
      <dc:date>2014-07-18T09:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505802#M1259314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rainer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don`t think, that a year can be defined differently - a year has 365 days except leap years. So it schould be no difficulty to check for leap years and return 1,0 instead of 1,002373 if there is are leap years in the caluculating period.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had another case to caluculated the age of employees in decimal. So for example the employee is about 60 years old - the difference will be 15 times 0,002373 = 0,035595. This effected the amount of pay-off.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don`t care about this fm &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/906/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt; I had to calculate a lot of time and date results during the last month. So now I have a template for nearly each case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 13:39:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505802#M1259314</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-07-18T13:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505803#M1259315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dieter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are different definitions for a year. At first I have for instance only the german article for month as a reference &lt;A href="http://de.wikipedia.org/wiki/Monat" title="http://de.wikipedia.org/wiki/Monat"&gt;Monat – Wikipedia&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Im &lt;A href="http://de.wikipedia.org/wiki/Privatrecht" title="Privatrecht"&gt;Privatrecht&lt;/A&gt; gilt in Deutschland ein Monat als Zeitraum von Tag &lt;EM&gt;x&lt;/EM&gt; bis Tag &lt;EM&gt;x&lt;/EM&gt; des Folgemonats. Wenn dieser keinen Tag &lt;EM&gt;x&lt;/EM&gt; hat, endet der Zeitraum mit dem letzten Tag des Folgemonats (&lt;SPAN class="plainlinks-print"&gt;&lt;A class="text external" href="http://www.gesetze-im-internet.de/bgb/__188.html" rel="nofollow"&gt;§ 188&lt;/A&gt;&lt;/SPAN&gt; Abs. 2 und 3 &lt;A href="http://de.wikipedia.org/wiki/B%C3%BCrgerliches_Gesetzbuch" title="Bürgerliches Gesetzbuch"&gt;BGB&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Im Bankwesen dauert ein Monat stets 30 Tage, ein Bankjahr dauert demzufolge lediglich 360 Tage.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;and so on. The reason is, that a month like a year is no physical well defined time unit. So calculating time differences precisely for month and year requires a precise definition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the function DURATION_DETERMINE follows exactly some of this definitions for year and month. So it is working correct. But it should not be used, if some other definitions are required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DURATION_DETERMINE is a function module that is used very often, so we should not cast a doubt that it has an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way I also would have prefered to use a function that calculates a year as you wanted (A year is over when day and month of the next year are equal to the previous year. And take the next day if this day does not exist due to a leap day. Does someone know such a function or method? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But however this functions will returns only integers for the year, not fractions. Unless someones gives a definition how to calculate a fraction based on years of unequal length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If payings are based from time differences in year, as you noticed in your last post, you are right, in that case it is important that the program logic exactly follows the logic of the written contract. So whenever DURATION_DETERMINE is used for year and month it should be checked, whether he really returns the result the customers required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards&lt;/P&gt;&lt;P&gt;Rainer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 14:02:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505803#M1259315</guid>
      <dc:creator>rainer_winkler</dc:creator>
      <dc:date>2014-07-18T14:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: DURATION_DETERMINE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505804#M1259316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah under this conditions you are right - I didn`t think about year definition for commercial use &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/906/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt; only about calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 14:09:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/duration-determine/m-p/5505804#M1259316</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-07-18T14:09:48Z</dc:date>
    </item>
  </channel>
</rss>

