<?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 Quantity converting incorrectly in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427000#M204600</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've got some code in a userexit (userexit_save_doc_prepare) that needs to convert a sales order's quantity (vbap-kwmeng) to an integer so that I can do further calculations with it.  However, the automatic conversion routines seem to be misfiring, and they also seem to be dependent on user settings (comma decimals vs. period decimals).  Here is a summary of the code and what it is doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: temp_quantity_out TYPE I.

LOOP AT xvbap.

    temp_quantity_out = xvbap-kwmeng.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I go to this part of the code in debug mode after entering '2' in the quantity of the material, the value it shows for xvbap-kwmeng is '2.000'.  However, after executing the conversion, the field temp_quantity_out has the value of '2000', instead of the '2' I was expecting.  This is throwing future calculations off.  How do I get a value of '2' from this field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried using a packed number.  I've tried using 'write to'.  I've tried using it to calculate without converting.  None of these have worked.  I even tried to find a conversion function, but didn't see anything.  Can you help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nathan Beeler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Jun 2006 23:19:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-06-14T23:19:35Z</dc:date>
    <item>
      <title>Quantity converting incorrectly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427000#M204600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I've got some code in a userexit (userexit_save_doc_prepare) that needs to convert a sales order's quantity (vbap-kwmeng) to an integer so that I can do further calculations with it.  However, the automatic conversion routines seem to be misfiring, and they also seem to be dependent on user settings (comma decimals vs. period decimals).  Here is a summary of the code and what it is doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: temp_quantity_out TYPE I.

LOOP AT xvbap.

    temp_quantity_out = xvbap-kwmeng.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I go to this part of the code in debug mode after entering '2' in the quantity of the material, the value it shows for xvbap-kwmeng is '2.000'.  However, after executing the conversion, the field temp_quantity_out has the value of '2000', instead of the '2' I was expecting.  This is throwing future calculations off.  How do I get a value of '2' from this field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried using a packed number.  I've tried using 'write to'.  I've tried using it to calculate without converting.  None of these have worked.  I even tried to find a conversion function, but didn't see anything.  Can you help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Nathan Beeler&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2006 23:19:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427000#M204600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-14T23:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Quantity converting incorrectly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427001#M204601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nathan,  I believe that you are seeing this behavior due to an attribute of the program itself.  In the MAIN  program, SAPMV45A,  click Go To-&amp;gt;Attributes.  In the dialog that appears, check to see if "Fix-Point Arithmatic" is checked.  If it is not, then this is causing your problem.  An easy fix is to check this on, but make sure that you test everything else thoroughly and make sure that every is ok.  Otherwise, you will need to divide by 1000 when moving to your INT field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be safer to divide by 1000, instead of marking as "Fix point arithmatic",  SAP has left it off for a reason.&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>Wed, 14 Jun 2006 23:24:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427001#M204601</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-06-14T23:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Quantity converting incorrectly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427002#M204602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Rich, for the quick response.  I would like to do the safer route and divide by 1000.  However, before I do can you tell me if that will always give a correct result - even for my coworker who uses 0,000 decimal notation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Nathan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Jun 2006 23:37:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427002#M204602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-14T23:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Quantity converting incorrectly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427003#M204603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nathan,  the external formatting is user specific per their user settings, however, this is EXTERNAL format only.  During the internal processing of the program, this field will always have a '.' as the decimal separator and it will not have any thousands separator. It will always look like 12345678.000 in debug mode.  So for this field, since it has 3 decimal places, the dividing by 1000 will always work.&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>Wed, 14 Jun 2006 23:42:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427003#M204603</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-06-14T23:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Quantity converting incorrectly</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427004#M204604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rich!  Problem solved.  Hopefully I will remember all this stuff when I run into it again in a few years (as I always seem to do).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2006 00:12:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/quantity-converting-incorrectly/m-p/1427004#M204604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-15T00:12:21Z</dc:date>
    </item>
  </channel>
</rss>

