<?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: Convert string to float in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564035#M1564702</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is great! It definitely looks like what we need. We'll give it a try now. Thanks a lot!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Dec 2010 19:29:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-12-23T19:29:48Z</dc:date>
    <item>
      <title>Convert string to float</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564031#M1564698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems extremely rudimentary but I haven't been able to find an answer yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to pass in a string representing a human-readable floating point (ie, non IEEE 754) and get its value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A straight up assignment of a string variable into a f variable doesn't work for thousand dividers. We would also need it for every scenarios:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;123.456&lt;/P&gt;&lt;P&gt;123,456&lt;/P&gt;&lt;P&gt;123456&lt;/P&gt;&lt;P&gt;123456,789&lt;/P&gt;&lt;P&gt;123.456,789&lt;/P&gt;&lt;P&gt;123,456.789&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;all should be valid inputs and the resolution should be dependent on system setting for number formats. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like a built-in ABAP call with no manual processing. I'm sure this problem has been encountered thousands of times and solved thousands of times. No point reinventing the wheel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 15:42:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564031#M1564698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-23T15:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to float</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564032#M1564699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Tested Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Output as below&lt;/U&gt;&lt;/P&gt;&lt;P&gt;String : 123,456,789,123.456&lt;/P&gt;&lt;P&gt;String : 123456789123.456&lt;/P&gt;&lt;P&gt;Float  :   1.2345678912345599E+11&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA v_str TYPE STRING VALUE '123,456,789,123.456'.
DATA v_flt TYPE F.

WRITE: / 'String :', v_str. "With Commas
REPLACE ALL OCCURRENCES OF ',' IN v_str WITH ''.
WRITE: / 'String :', v_str. "Without Commas
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1
                        CONVERSION_ERRORS = 2.
  MOVE v_str TO v_flt.
ENDCATCH.
WRITE: / 'Float  :', v_flt. "Float value&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 16:31:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564032#M1564699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-23T16:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to float</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564033#M1564700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Priyanka,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the response. The thing is we cannot be certain that ',' are in fact thousand separators and the '.' is the decimal point. It depends on system settings (ie, the Europeans have it the other way around)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd be surprised if there isn't a built-in function or class that does it while taking system settings into account.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 16:51:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564033#M1564700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-23T16:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to float</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564034#M1564701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xiao Yu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use function module RS_CONV_EX_2_IN. In parameters, you must give a table name and field of type f or P with enough decimals. Can use any table/structure or define one yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The FM will regard all applicable country and user settings. If conversion fails you get a qualified exception via sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This FM is used by SAP for input conversion in editable ALV. ALV cells are 2555 character fields, so it should work for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 17:01:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564034#M1564701</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-12-23T17:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to float</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564035#M1564702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is great! It definitely looks like what we need. We'll give it a try now. Thanks a lot!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 19:29:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564035#M1564702</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-23T19:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Convert string to float</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564036#M1564703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So we are sure that we will have '.' or ',' in which ever the currency format. Remove all ',' and '.' in the string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"Contiunation to my previous helpful answere -&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So replace all ',' and '.' as said in my previous answere. and note here is we will have decimals 2. So make the final string to have 2 decimals and convert to float.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Dec 2010 08:22:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/convert-string-to-float/m-p/7564036#M1564703</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-24T08:22:55Z</dc:date>
    </item>
  </channel>
</rss>

