<?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: Fighting with decimals. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070728#M94651</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I looks to be rounding to the nearest,  if you need to be more precise, extend the decimal places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

DATA var1 TYPE p DECIMALS &amp;lt;b&amp;gt;3&amp;lt;/b&amp;gt;.


var1 = 364 / 365.

write:/ var1.




&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you will get .997&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Nov 2005 02:08:10 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-11-25T02:08:10Z</dc:date>
    <item>
      <title>Fighting with decimals.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070727#M94650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm doing something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA var1 TYPE p DECIMALS 2.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var1 = 364 / 365. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect to receive "0.99" but instead of I receive "1.00".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone explain me a little, of how to work with decimals in ABAP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 01:55:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070727#M94650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-25T01:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Fighting with decimals.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070728#M94651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I looks to be rounding to the nearest,  if you need to be more precise, extend the decimal places.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

DATA var1 TYPE p DECIMALS &amp;lt;b&amp;gt;3&amp;lt;/b&amp;gt;.


var1 = 364 / 365.

write:/ var1.




&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you will get .997&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 02:08:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070728#M94651</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-25T02:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Fighting with decimals.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070729#M94652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need it to be 2 decimals places, then you can do something like this.  There must be a better way, I can't seem to give you one at the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

DATA var1 TYPE p DECIMALS 3.
data: xvar1(10) type c.
data: xvar2 type p decimals 2.


var1 = 364 / 365.

write var1 to xvar1.
shift xvar1 right deleting trailing space.
shift xvar1 right by 1 places.

xvar2 = xvar1.

write:/ xvar2.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 02:24:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070729#M94652</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-25T02:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fighting with decimals.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070730#M94653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The system will always want to round up. If you values where just a little different, of course it would show the decimal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

DATA var1 TYPE p DECIMALS 2.

var1 = &amp;lt;b&amp;gt;360&amp;lt;/b&amp;gt; / 365.

write:/ var1. " VALUE is .99

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find these answers a little helpful, please award points accordingly,  Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 02:26:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070730#M94653</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-25T02:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Fighting with decimals.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070731#M94654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you always want to round down the divsion, here is a better way.  Not sure what I was thinking, maybe too much Thanksgiving Turkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

DATA var1 TYPE p DECIMALS 2.

var1 = ( floor( ( 364 / 365 ) * 100 ) ) / 100.

WRITE:/ var1.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here we are doing the division, multpling by 100 for the decimal places(value now is 99.7) then round down using FLOOR(value now is 99.0,  then dividing by 100 for the 2 decimals places(value now is .99&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 02:46:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070731#M94654</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-25T02:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Fighting with decimals.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070732#M94655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's it, thanx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2005 02:58:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fighting-with-decimals/m-p/1070732#M94655</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-25T02:58:45Z</dc:date>
    </item>
  </channel>
</rss>

