<?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: ceil calculation is wrong in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129009#M1365089</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;how does CEIL work.... ?&lt;/P&gt;&lt;P&gt;   After the decimal even if there is a single digit without 0 then it adds 1 to the result....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now taking your scenario...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CEIL( 204000 * ( 1 / 6000 ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firstly the inner braces are calculated but they are not ceiled because CEIL is to be applied for the final result according to the statement above....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now, 1 / 6000 is calculated and the output is 0.000166... goes on...  or you can say 1.666666667e-4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;since floating point numbers supports till certain numbers so this number becomes &lt;/P&gt;&lt;P&gt;0.000167&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now when you calculate 0.000167 * 204000&lt;/P&gt;&lt;P&gt;the result is 34.068&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if CEIL is applied to this result..... it converts the number 34.068 to 35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want to cross check you can also use this statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CEIL(24 * ( 1 / 6 ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will result in the value 5 whereas it is 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for this case you will have to modify your logic a bit for you not to get this inappropriate results....&lt;/P&gt;&lt;P&gt;instead of using CEIL or any others functions&lt;/P&gt;&lt;P&gt;declare an integer variable &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how it works....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA w_int TYPE i.
w_int = w_no_of_cases_temp.
write w_int.

*this should resolve your issue......&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Aug 2009 10:52:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-31T10:52:46Z</dc:date>
    <item>
      <title>ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129002#M1365082</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;I am using below formula to calculate no of cases&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        w_no_of_cases_temp = CEIL( vbdpr-fkimg *&lt;/P&gt;&lt;P&gt;                               (  marm-umren / marm-umrez ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input value is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vbdpr-fkimg  = 204000&lt;/P&gt;&lt;P&gt; marm-umren  = 1&lt;/P&gt;&lt;P&gt;marm-umrez  = 6000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;output is 35. But it should be 34. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i checke few cases. Output is correct. Above itme oly i am getting wrong output. Kindly help me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 09:15:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129002#M1365082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T09:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129003#M1365083</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 TRUNC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

w_no_of_cases_temp = TRUNC( vbdpr-fkimg *
( marm-umren / marm-umrez ) ).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 09:17:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129003#M1365083</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T09:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129004#M1365084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vikranth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i use this formula the deciaml places is displaying.  I dont want decimai places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls help me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 10:06:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129004#M1365084</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T10:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129005#M1365085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the type of the variable w_no_of_cases_temp ? Try declaring it as type p and check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: w_no_of_cases_temp type p.

w_no_of_cases_temp = TRUNC( vbdpr-fkimg *
( marm-umren / marm-umrez ) ).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 10:15:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129005#M1365085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T10:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129006#M1365086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi kumar,&lt;/P&gt;&lt;P&gt;how will  "*204000 * 1 / 6000* ." become 35???? its 34&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 10:25:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129006#M1365086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T10:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129007#M1365087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
data:w_no_of_cases_temp type p.
w_no_of_cases_temp = ( 204000 * ( 1 / 6000 ) ).  "=34
write w_no_of_cases_temp.
w_no_of_cases_temp = CEIL( 204000 * ( 1 / 6000 ) )."=35
write w_no_of_cases_temp.
w_no_of_cases_temp = FLOOR( 204000 * ( 1 / 6000 ) )."=34
write w_no_of_cases_temp.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why CEIL ???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 10:34:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129007#M1365087</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-08-31T10:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129008#M1365088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;read this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;command                     result&lt;/P&gt;&lt;P&gt;ABS                           Absolute value of argument &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CEIL                           Smallest integer value   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLOOR                      Largest integer value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRUNC                      Integer part of argument &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FRAC                        Fraction part of argument&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now use as per your requirement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 10:47:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129008#M1365088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T10:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: ceil calculation is wrong</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129009#M1365089</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;how does CEIL work.... ?&lt;/P&gt;&lt;P&gt;   After the decimal even if there is a single digit without 0 then it adds 1 to the result....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now taking your scenario...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CEIL( 204000 * ( 1 / 6000 ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;firstly the inner braces are calculated but they are not ceiled because CEIL is to be applied for the final result according to the statement above....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now, 1 / 6000 is calculated and the output is 0.000166... goes on...  or you can say 1.666666667e-4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;since floating point numbers supports till certain numbers so this number becomes &lt;/P&gt;&lt;P&gt;0.000167&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now when you calculate 0.000167 * 204000&lt;/P&gt;&lt;P&gt;the result is 34.068&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if CEIL is applied to this result..... it converts the number 34.068 to 35&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you want to cross check you can also use this statement &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CEIL(24 * ( 1 / 6 ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will result in the value 5 whereas it is 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for this case you will have to modify your logic a bit for you not to get this inappropriate results....&lt;/P&gt;&lt;P&gt;instead of using CEIL or any others functions&lt;/P&gt;&lt;P&gt;declare an integer variable &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how it works....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA w_int TYPE i.
w_int = w_no_of_cases_temp.
write w_int.

*this should resolve your issue......&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Siddarth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 10:52:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ceil-calculation-is-wrong/m-p/6129009#M1365089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-31T10:52:46Z</dc:date>
    </item>
  </channel>
</rss>

