<?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 Converting Float to P type without rounding in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352712#M1640239</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello people,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking for a function, or even a pease of code to convert F variables to P variables without rounding the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel Marchena&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: danielmp on Nov 28, 2011 1:22 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 28 Nov 2011 12:09:41 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-11-28T12:09:41Z</dc:date>
    <item>
      <title>Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352712#M1640239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello people,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm looking for a function, or even a pease of code to convert F variables to P variables without rounding the value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks alot,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Daniel Marchena&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: danielmp on Nov 28, 2011 1:22 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 12:09:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352712#M1640239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T12:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352713#M1640240</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;Could you please elaborate more on the requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 12:31:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352713#M1640240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T12:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352714#M1640241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you try to convert a floating field value with, say 9 decimals, to a packed type with 2 or 4 decimals without rounding, you can look for a long  time...  (read [Conversion Rules for Elementary Data Types|http://help.sap.com/abapdocu_70/en/ABENCONVERSION_ELEMENTARY.htm] for [Conversion table for source field type f|http://help.sap.com/abapdocu_70/en/ABENCONVERSION_TYPE_F.htm] )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;AFAIK conversion from floating point is always subject to rounding (?) So try to convert the result back to floating and if this new value is greater than the original value, subtract 1 to the result of the first conversion (at rightmost position of decimal)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 12:32:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352714#M1640241</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2011-11-28T12:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352715#M1640242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a f(15) value 98.9898989 and i want to pass it to a p(15) decimals 3 for example, without rounding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 12:45:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352715#M1640242</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T12:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352716#M1640243</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 have no idea of any function module or something doing that but I have a method...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Follow below steps:&lt;/P&gt;&lt;P&gt;DATA: GV_STR TYPE STRING,&lt;/P&gt;&lt;P&gt;            GV_STR1 TYPE STRING,&lt;/P&gt;&lt;P&gt;            GV_STR2 TYPE STRING.&lt;/P&gt;&lt;P&gt;1. Copy your float type to a string say GV_STR.&lt;/P&gt;&lt;P&gt;2. Use SPLIT 'GV_STR' AT '.' INTO GV_STR1 GV_STR2.&lt;/P&gt;&lt;P&gt;3. CLEAR GV_STR.&lt;/P&gt;&lt;P&gt;4. CONCATENATE GV_STR1 '.' GV_STR2+0(3) INTO GV_STR. " here in this step 3 is the number of decimals you wish to  have&lt;/P&gt;&lt;P&gt;5. YOUR TYPE P FIELD = GV_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352716#M1640243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T13:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352717#M1640244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA: FLOAT TYPE f,&lt;/P&gt;&lt;P&gt;      PACKED TYPE p.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: GV_STR TYPE STRING,&lt;/P&gt;&lt;P&gt;      GV_STR1 TYPE STRING,&lt;/P&gt;&lt;P&gt;      GV_STR2 TYPE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GV_STR = FLOAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPLIT GV_STR AT '.' INTO GV_STR1 GV_STR2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR GV_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE GV_STR1 '.' GV_STR2+0(3) INTO GV_STR. " here in this step 3 is the number of decimals you wish to have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKED = GV_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE PACKED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Even like that, when i make the variable "PACKED" receive "GV_STR" it rounds the value.&lt;/STRONG&gt;&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;Edited by: danielmp on Nov 28, 2011 2:20 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:19:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352717#M1640244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T13:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352718#M1640245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Heyy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you just specified PACKED type P.&lt;/P&gt;&lt;P&gt;so there will be no decimal points...&lt;/P&gt;&lt;P&gt;please specify as PACKED TYPE P LENGHT &amp;lt;AS REQUIRED&amp;gt; DECIMALS &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt; or as required&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Tried using 3 for your given example of 98.9898989&lt;/P&gt;&lt;P&gt;it printed 98.989 for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;-Sandeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:23:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352718#M1640245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T13:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352719#M1640246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try this one,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT.

DATA: YOUR_DEC TYPE N LENGTH 02 VALUE 03.
DATA: F1 TYPE F,
      P1 TYPE P DECIMALS 3,
      C1 TYPE C LENGTH 256,
      S1 TYPE STRING,
      S2 TYPE STRING,
      S3 TYPE STRING.

F1 = '9999999999.9898989'.

WRITE F1 TO C1 EXPONENT 0.
CONDENSE C1 NO-GAPS.

SPLIT C1 AT '.' INTO S1 S2.
CONCATENATE S1 S2+0(YOUR_DEC) INTO S3 SEPARATED BY '.'.
P1 = S3.
WRITE P1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help,&lt;/P&gt;&lt;P&gt;Tiwa N.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Tiwa Noitawee on Nov 28, 2011 3:45 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:52:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352719#M1640246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T13:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Float to P type without rounding</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352720#M1640247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Thank's a lot everyone.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The following code solved my problem:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZNAME.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: FLOAT         TYPE f,&lt;/P&gt;&lt;P&gt;           PACKED(15) TYPE p DECIMALS 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: GV_STR TYPE STRING,&lt;/P&gt;&lt;P&gt;            GV_STR1 TYPE STRING, &lt;/P&gt;&lt;P&gt;            GV_STR2 TYPE STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GV_STR = FLOAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPLIT GV_STR AT '.' INTO GV_STR1 GV_STR2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR GV_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONCATENATE GV_STR1 '.' GV_STR2+0(3) INTO GV_STR. " here in this step 3 is the number of decimals you wish to have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PACKED = GV_STR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE PACKED.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Nov 2011 15:52:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-float-to-p-type-without-rounding/m-p/8352720#M1640247</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-28T15:52:12Z</dc:date>
    </item>
  </channel>
</rss>

