<?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: remove decimal places in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897924#M54628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;that depends wether you want to have truncation or not. If you would like to have the number rounded up you simply can define an intermeditate variable. Else the use of the statement trunc should help.&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
program test.

write: / ' CAST'.  perform cast  using :  '1.011',  '2.036'.
write: / 'TRUNC'. perform trunc using :  '1.011',  '2.036'.


form cast using value type p.

  data:
    3decs type p length 9 decimals 3,
    2decs type p length 9 decimals 2.

  3decs = value.
  write : 3decs.

  3decs = 2decs = 3decs.
  write : 3decs.

endform.

form trunc using value type p.

  data:
    3decs type p length 9 decimals 3.

  3decs = value.
  write : 3decs.

  3decs = ( trunc( 100 * 3decs ) / 100 ).
  write : 3decs.

endform.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 May 2005 17:04:27 GMT</pubDate>
    <dc:creator>former_member183804</dc:creator>
    <dc:date>2005-05-12T17:04:27Z</dc:date>
    <item>
      <title>remove decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897922#M54626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is probably very easy, but i couldn't find the information I need yet.&lt;/P&gt;&lt;P&gt;I have a field in my db-table with type P (length 9, decimal places 3). &lt;/P&gt;&lt;P&gt;when i copy a value with 3 decimal places (e.g. 1,234) into the field, I want to remove the last digit (4), so the result should be 1,23. How do I do this without changing the data type and lenght of the field?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2005 16:35:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897922#M54626</guid>
      <dc:creator>daniel_humberg</dc:creator>
      <dc:date>2005-05-12T16:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: remove decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897923#M54627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your field is defined as type p decimals 3, then that is the format that it will take in the database.  If you want to display this value in a program a different way, then you should use the following logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

Data: x type p decimals 3 value '1.234'.
Data: y type p decimals 2.

y = x.

Write:/ x.
Write:/ y.

&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>Thu, 12 May 2005 17:03:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897923#M54627</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-05-12T17:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: remove decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897924#M54628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Daniel,&lt;/P&gt;&lt;P&gt;that depends wether you want to have truncation or not. If you would like to have the number rounded up you simply can define an intermeditate variable. Else the use of the statement trunc should help.&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Klaus&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
program test.

write: / ' CAST'.  perform cast  using :  '1.011',  '2.036'.
write: / 'TRUNC'. perform trunc using :  '1.011',  '2.036'.


form cast using value type p.

  data:
    3decs type p length 9 decimals 3,
    2decs type p length 9 decimals 2.

  3decs = value.
  write : 3decs.

  3decs = 2decs = 3decs.
  write : 3decs.

endform.

form trunc using value type p.

  data:
    3decs type p length 9 decimals 3.

  3decs = value.
  write : 3decs.

  3decs = ( trunc( 100 * 3decs ) / 100 ).
  write : 3decs.

endform.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 May 2005 17:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897924#M54628</guid>
      <dc:creator>former_member183804</dc:creator>
      <dc:date>2005-05-12T17:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: remove decimal places</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897925#M54629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this:    WRITE:/ x decimals 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 May 2005 06:08:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/remove-decimal-places/m-p/897925#M54629</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2005-05-13T06:08:03Z</dc:date>
    </item>
  </channel>
</rss>

