<?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: Issue with passing decimal values in ABAP Code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845874#M1684663</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Keerthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The perennial problem of developers overlooking the units for currency/quantity fields &lt;SPAN __jive_emoticon_name="sad" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/825/images/emoticons/sad.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the field &lt;EM&gt;ls_block_temp-tgt_doh&lt;/EM&gt; a currency/quantity field? If yes, then what is the value in the corres. reference field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you check the reference field &lt;EM&gt;VRKME&lt;/EM&gt; - what is UoM?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="310136" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://community.sap.com/"&gt;&lt;/A&gt;: Nice observation &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/825/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&amp;nbsp; &lt;A&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Suhas Saha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Jun 2012 13:24:36 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2012-06-28T13:24:36Z</dc:date>
    <item>
      <title>Issue with passing decimal values in ABAP Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845873#M1684662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing a strange issue in one of my developments.&lt;/P&gt;&lt;P&gt;I am trying to pass a decimal value stored in a variable (let's say variable 'A') to another Type 'P' variable (let's say variable 'B').&lt;/P&gt;&lt;P&gt;I am doing this inside the Sales User exit - USEREXIT_SAVE_DOCUMENT_PREPARE inside the include MV45AFZZ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable 'A' has been declared in the ABAP dictionary as a Decimal of length '5' and decimal places '2'.&lt;/P&gt;&lt;P&gt;Variable 'B' refers to the data element KWMENG (quantity), which is of length '15' and decimal places '3'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I pass a value of '24.00' from 'A' to 'B', it gets converted to '2.40'.&lt;/P&gt;&lt;P&gt;If I was initially surprised to find this, I got even more surprised when I wrote a random test program with similar variables declared. &lt;/P&gt;&lt;P&gt;I found that the value got passed fine in the test program, with no change of data, except for the additional decimal place getting added, of course.&lt;/P&gt;&lt;P&gt;I have attached snapshots of these 2 scenarios from the ABAP debug screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have any of you faced a similar issue earlier, and if so, can you please enlighten me about what I might be doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Keerthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 13:12:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845873#M1684662</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-06-28T13:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with passing decimal values in ABAP Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845874#M1684663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Keerthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The perennial problem of developers overlooking the units for currency/quantity fields &lt;SPAN __jive_emoticon_name="sad" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/825/images/emoticons/sad.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the field &lt;EM&gt;ls_block_temp-tgt_doh&lt;/EM&gt; a currency/quantity field? If yes, then what is the value in the corres. reference field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you check the reference field &lt;EM&gt;VRKME&lt;/EM&gt; - what is UoM?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="310136" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://community.sap.com/"&gt;&lt;/A&gt;: Nice observation &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/825/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&amp;nbsp; &lt;A&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Suhas Saha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 13:24:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845874#M1684663</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2012-06-28T13:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with passing decimal values in ABAP Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845875#M1684664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Keerthi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the userexits of MV45AFZZ, you belong to the main program SAPMV45A. &lt;EM&gt;The fixed-point arithmetic is switched off in &lt;/EM&gt;the&lt;EM&gt; properties of SAPMV45A &lt;/EM&gt;(like in many others of the 'classical' ABAP programs of the ERP core).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This explains the difference you observed. In your MV45AFZZ example, the variable 24.00 is considered as 2400, which, by moving to the quantity field, gives 2.400&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rüdiger&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.: This, by the way, is another argument to use the exits of SD only as exit points and to jump into custom classes or function groups immediately from there. It is worth the effort to pass the necessary tables like XVBAP etc. through the signature of your custom methods. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 13:26:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845875#M1684664</guid>
      <dc:creator>Ruediger_Plantiko</dc:creator>
      <dc:date>2012-06-28T13:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with passing decimal values in ABAP Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845876#M1684665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;They are indeed Quantity fields, but I have already checked the corresponding reference fields/tables.&lt;/P&gt;&lt;P&gt;I have in fact maintained them the same way the Cumulative Order quantity field (VBAP-KWMENG) is maintained in VBAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For me, Rudiger's point makes more sense. I say this because trust me when I say I have played around with quite a lot of permutations and combinations of data types for these variables, with the exact same result every single time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the way I read it, the best way for me to do any such quantity based calculations should be inside a custom Function Module / Method&amp;nbsp; - Rudiger please correct me if I have got it wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Keerthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 14:25:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845876#M1684665</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-06-28T14:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with passing decimal values in ABAP Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845877#M1684666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Keerthi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yeah, that's precisely what I would recommend: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the "old" customer exits - which are only "perform" calls in the standard SD processing logic - only as a hook for calling your own code. The best would be to directly call a custom method or function module. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The advantage of the form routines is that you have all the globals of SAPMV45A at your hands. But the price is that you depend on the main program, leading to strange behaviour like the one you observed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is good, also for testing, to design your methods with the necessary data in their interface(signature).&amp;nbsp; You can then write your own module tests for your own code, by emulating some interface data for test calls. Also, you could provide a switch to deactivate your exits, in order to prove that some strange behaviour of the order processing is not caused by your modifications (in simple cases, it will suffice to comment-out the call temporarily for such kind of proofs). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you create a new program or function module, the flag "fixed-point" arithmetics will be automatically switched on.&amp;nbsp; But the old module pools like SAPMV45A have it switched off, as you can see in the "properties" screen of the editor. See the F1 help of this flag for further documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rüdiger&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 15:28:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-passing-decimal-values-in-abap-code/m-p/8845877#M1684666</guid>
      <dc:creator>Ruediger_Plantiko</dc:creator>
      <dc:date>2012-06-28T15:28:44Z</dc:date>
    </item>
  </channel>
</rss>

