<?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: Rounding Function in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765657#M905996</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much karthik. Rewards to you from me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Aug 2012 15:43:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-08-03T15:43:15Z</dc:date>
    <item>
      <title>Rounding Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765654#M905993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am bringing in external data and stuffing it directly into a table. The &lt;/P&gt;&lt;P&gt;external data has a price field that is 4 decimals and I am putting it into &lt;/P&gt;&lt;P&gt;a field that has only 2 decimal places. It seems that instead of rounding, &lt;/P&gt;&lt;P&gt;the last 2 places are being truncated. This is causing a small variance &lt;/P&gt;&lt;P&gt;when I compare the totals before and after the migration. What I need is a &lt;/P&gt;&lt;P&gt;rounding function that will put the correct value into the field?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2008 17:19:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765654#M905993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-24T17:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765655#M905994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI asish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rounding function&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try any of these, though #1 is probably yr best bet: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) ROUND - round a number &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SIGN parameter determines the rounding type: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Value Meaning &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ Round up (10.55 =&amp;gt; 10.60) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Round down (10.55 =&amp;gt; 10.50) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;X Commercial (10.55 =&amp;gt; 10.60) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;' ' No rounding (10.55 =&amp;gt; 10.55) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) ROUND_AMOUNT - rounding based on company code and currency &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(3) HR_ROUND_NUMBER - rounding rules defined in T559R&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ABAP Code - Rounding Up&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls have a look at the following. &lt;/P&gt;&lt;P&gt;The function CEIL or FLOOR might help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ABS, SIGN, CEIL, FLOOR, TRUNC, and FRAC Functions &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: I TYPE I, &lt;/P&gt;&lt;P&gt;P TYPE P DECIMALS 2, &lt;/P&gt;&lt;P&gt;M TYPE F VALUE '-3.5', &lt;/P&gt;&lt;P&gt;D TYPE P DECIMALS 1. &lt;/P&gt;&lt;P&gt;P = ABS( M ). " 3,5 &lt;/P&gt;&lt;P&gt;I = P. " 4 - business rounding &lt;/P&gt;&lt;P&gt;I = M. " -4 &lt;/P&gt;&lt;P&gt;I = CEIL( P ). " 4 - next largest whole number &lt;/P&gt;&lt;P&gt;I = CEIL( M ). " -3 &lt;/P&gt;&lt;P&gt;I = FLOOR( P ). " 3 - next smallest whole number &lt;/P&gt;&lt;P&gt;I = FLOOR( M ). " -4 &lt;/P&gt;&lt;P&gt;I = TRUNC( P ). " 3 - integer part &lt;/P&gt;&lt;P&gt;I = TRUNC( M ). " -3 &lt;/P&gt;&lt;P&gt;D = FRAC( P ). " 0.5 - decimal part &lt;/P&gt;&lt;P&gt;D = FRAC( M ). " -0.5&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;&lt;/P&gt;&lt;P&gt;Formatting Options &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use various formatting options with the WRITE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE .... &amp;lt;f&amp;gt; &amp;lt;option&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Formatting options for all data types&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option&lt;/P&gt;&lt;P&gt; Function&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LEFT-JUSTIFIED&lt;/P&gt;&lt;P&gt; Output is left-justified.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CENTERED&lt;/P&gt;&lt;P&gt; Output is centered.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;RIGHT-JUSTIFIED&lt;/P&gt;&lt;P&gt; Output is right-justified.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;UNDER &amp;lt;g&amp;gt;&lt;/P&gt;&lt;P&gt; Output starts directly under field &amp;lt;g&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;NO-GAP&lt;/P&gt;&lt;P&gt; The blank after field &amp;lt;f&amp;gt; is omitted.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;USING EDIT MASK &amp;lt;m&amp;gt;&lt;/P&gt;&lt;P&gt; Specifies format template &amp;lt;m&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;USING NO EDIT MASK&lt;/P&gt;&lt;P&gt; Deactivates a format template specified in the ABAP Dictionary.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;NO-ZERO&lt;/P&gt;&lt;P&gt; If a field contains only zeros, these are replaced by blanks. For type C and N fields, leading zeros are replaced automatically.&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;&lt;/P&gt;&lt;P&gt;Formatting options for numeric fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option&lt;/P&gt;&lt;P&gt; Function&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;NO-SIGN&lt;/P&gt;&lt;P&gt; The leading sign is not displayed on the screen.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DECIMALS &amp;lt;d&amp;gt;&lt;/P&gt;&lt;P&gt; &amp;lt;d&amp;gt; defines the number of digits after the decimal point.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;EXPONENT &amp;lt;e&amp;gt;&lt;/P&gt;&lt;P&gt; In type F fields, the exponent is defined in &amp;lt;e&amp;gt;.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;ROUND &amp;lt;r&amp;gt;&lt;/P&gt;&lt;P&gt; Type P fields are multiplied by 10**(-r) and then rounded.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;CURRENCY &amp;lt;c&amp;gt;&lt;/P&gt;&lt;P&gt; Format according to currency &amp;lt;c&amp;gt; in table TCURX.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;UNIT &amp;lt;u&amp;gt;&lt;/P&gt;&lt;P&gt; The number of decimal places is fixed according to unit &amp;lt;u&amp;gt; specified in table T006 for type P fields.&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;&lt;/P&gt;&lt;P&gt;Formatting options for date fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Option&lt;/P&gt;&lt;P&gt; Function&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DD/MM/YY&lt;/P&gt;&lt;P&gt; Separators as defined in user&amp;#146;s master record.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MM/DD/YY&lt;/P&gt;&lt;P&gt; Separators as defined in user&amp;#146;s master record.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DD/MM/YYYY&lt;/P&gt;&lt;P&gt; Separators as defined in user&amp;#146;s master record.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MM/DD/YYYY&lt;/P&gt;&lt;P&gt; Separators as defined in user&amp;#146;s master record.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DDMMYY&lt;/P&gt;&lt;P&gt; No separators.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;MMDDYY&lt;/P&gt;&lt;P&gt; No separators.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;YYMMDD&lt;/P&gt;&lt;P&gt; No separators.&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;&lt;/P&gt;&lt;P&gt;For more information on formatting options and the exclusion principles for some of these options, see the keyword documentation of the WRITE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are some examples of formatting options. For more examples, see Creating Complex Lists. The decimal character and thousands separators (period or comma) of numeric fields are defined in the user&amp;#146;s master record&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP Code&lt;/P&gt;&lt;P&gt; Screen output&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA: g(5) TYPE c VALUE 'Hello',&lt;/P&gt;&lt;P&gt;      f(5) TYPE c VALUE 'Dolly'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: g, f.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: /10 g,&lt;/P&gt;&lt;P&gt;       /   f UNDER g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / g NO-GAP, f.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello Dolly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          Hello&lt;/P&gt;&lt;P&gt;          Dolly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HelloDolly&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA time TYPE t VALUE '154633'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: time,&lt;/P&gt;&lt;P&gt;  /(8) time USING EDIT MASK '__:__:__'.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;154633&lt;/P&gt;&lt;P&gt;15:46:33&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;WRITE: '000123',&lt;/P&gt;&lt;P&gt;     / '000123' NO-ZERO.&lt;/P&gt;&lt;P&gt; 000123&lt;/P&gt;&lt;P&gt;   123&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA float TYPE f VALUE '123456789.0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE float EXPONENT 3.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123456,789E+03&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA pack TYPE p VALUE '123.456'&lt;/P&gt;&lt;P&gt;                        DECIMALS 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE pack DECIMALS 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / pack ROUND -2,&lt;/P&gt;&lt;P&gt;       / pack ROUND -1,&lt;/P&gt;&lt;P&gt;       / pack ROUND 1,&lt;/P&gt;&lt;P&gt;       / pack ROUND 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;    123,46&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;12.345,600&lt;/P&gt;&lt;P&gt;1.234,560&lt;/P&gt;&lt;P&gt;    12,346&lt;/P&gt;&lt;P&gt;     1,235&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;WRITE: sy-datum,&lt;/P&gt;&lt;P&gt;     / sy-datum yymmdd.&lt;/P&gt;&lt;P&gt; 27.06.1995&lt;/P&gt;&lt;P&gt;950627&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apart from the formatting options shown in the above tables, you can also use the formatting options of the FORMAT statement. These options allow you to specify the intensity and color of your output. For more information, see The FORMAT Statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;karthik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward me if usefull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2008 17:28:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765655#M905994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-24T17:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765656#M905995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you need to store the external value in a variable that is declared to 4 &lt;/P&gt;&lt;P&gt;decimal places and the use the round function to round it back to 2 places &lt;/P&gt;&lt;P&gt;before updating to your table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Apr 2008 18:22:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765656#M905995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-26T18:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding Function</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765657#M905996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much karthik. Rewards to you from me&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2012 15:43:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rounding-function/m-p/3765657#M905996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-08-03T15:43:15Z</dc:date>
    </item>
  </channel>
</rss>

