<?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: Runtime error :COMPUTE_BCD_OVERFLOW in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546135#M1073697</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kothand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               Your guess is true.I am facing the problem while calculating the field wa_nriv-M_dooms.&lt;/P&gt;&lt;P&gt;I don't need to show any message to user.Is there any possibility to overcome the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Oct 2008 06:09:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-08T06:09:45Z</dc:date>
    <item>
      <title>Runtime error :COMPUTE_BCD_OVERFLOW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546133#M1073695</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 am getting the run time error as "Overflow for arithmetical operation (type P) in program".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the part of my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Types:  begin of ty_nriv,

         OBJECT    type NROBJ,

         SUBOBJECT type NRSOBJ,

         NRRANGENR   type NRNR,

         TOYEAR     type NRYEAR,

         minnumber   type NRFROM,

         maxnumber   type NRto,

         CurrentNumber type NRLEVEL,

         No_range type NRTO,

         useage   type P decimals 6, 

         M_dooms  type P decimals 4,

       end of ty_nriv.


data:g_object type nriv-object,
       tab_nriv type standard table of TY_nriv ,
       WA_NRIV TYPE TY_NRIV,
      GV_YEAR(4) TYPE N,.

*selection screen

select-options:  s_object for g_object .

*start-of-slection.

select  OBJECT

           SUBOBJECT

           NRRANGENR

           TOYEAR

           FROMNUMBER

           tonumber

           NRLEVEL

           from nriv

           into table tab_nriv

          where object in s_object

             and TOYEAR &amp;lt; GV_YEAR.
 

  loop at tab_nriv into wa_nriv.
 

    WA_NRIV-No_range = WA_NRIV-maxnumber - WA_NRIV-minnumber + 1 .
 

    wa_nriv-useage = ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) / WA_NRIV-No_range ) * 100 .

 
    wa_nriv-M_dooms = 50 / ( ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) / ( wa_nriv-No_range + 1 ) )

      / ( 1 - ( wa_nriv-currentnumber - WA_NRIV-minnumber + 1 ) / ( WA_NRIV-No_range + 1 ) ) ).

 
      modify tab_nriv from wa_nriv transporting  No_range useage M_dooms.

 
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me out in this issue.&lt;/P&gt;&lt;P&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;*P.S- I have tried with increase the length of packed type of decimals 10 and with data element KTMNG.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 05:53:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546133#M1073695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-08T05:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error :COMPUTE_BCD_OVERFLOW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546134#M1073696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Swetha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I guess the following calculation causes division by zero ( which is infinity ) somewhere, so you are getting this dump&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
wa_nriv-M_dooms = 50 / ( ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) / ( wa_nriv-No_range + 1 ) )
 
      / ( 1 - ( wa_nriv-currentnumber - WA_NRIV-minnumber + 1 ) / ( WA_NRIV-No_range + 1 ) ) ).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can give that calculation inside try catch to avoid the dump and capture the error.. like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TRY.
wa_nriv-M_dooms = 50 / ( ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) / ( wa_nriv-No_range + 1 ) )
 
      / ( 1 - ( wa_nriv-currentnumber - WA_NRIV-minnumber + 1 ) / ( WA_NRIV-No_range + 1 ) ) ).
CATCH CX_ROOT.
  Message 'Error'.
ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kothand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 06:05:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546134#M1073696</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-08T06:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error :COMPUTE_BCD_OVERFLOW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546135#M1073697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kothand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               Your guess is true.I am facing the problem while calculating the field wa_nriv-M_dooms.&lt;/P&gt;&lt;P&gt;I don't need to show any message to user.Is there any possibility to overcome the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 06:09:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546135#M1073697</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-08T06:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error :COMPUTE_BCD_OVERFLOW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546136#M1073698</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;  Overcome the error?  SAP will not support division by zero as well as infinity value cannot be handled in SAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you dont want anything to happen if the case is division by zero, then leave the program without Message like,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TRY.

wa_nriv-M_dooms = 50 / ( ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) / ( wa_nriv-No_range + 1 ) )
 
      / ( 1 - ( wa_nriv-currentnumber - WA_NRIV-minnumber + 1 ) / ( WA_NRIV-No_range + 1 ) ) ).

CATCH CX_ROOT.
*   Do Nothing

ENDTRY.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So that the value of wa_nriv-M_dooms will be zero in case of division be zero. I think this can avoid the dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kothand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 06:18:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546136#M1073698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-08T06:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error :COMPUTE_BCD_OVERFLOW</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546137#M1073699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Swetha,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Below Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Types: begin of ty_nriv,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OBJECT type NROBJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUBOBJECT type NRSOBJ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NRRANGENR type NRNR,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOYEAR type NRYEAR,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;minnumber type NRFROM,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;maxnumber type NRto,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CurrentNumber type NRLEVEL,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No_range type NRTO,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;useage type P decimals 6,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;M_dooms type P decimals 4,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end of ty_nriv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:g_object type nriv-object,&lt;/P&gt;&lt;P&gt;tab_nriv type standard table of TY_nriv ,&lt;/P&gt;&lt;P&gt;WA_NRIV TYPE TY_NRIV,&lt;/P&gt;&lt;P&gt;GV_YEAR(4) TYPE N .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:c type P decimals 6,&lt;/P&gt;&lt;P&gt;     d type P decimals 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*selection screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options: s_object for g_object .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*start-of-slection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select OBJECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUBOBJECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NRRANGENR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOYEAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FROMNUMBER&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tonumber&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NRLEVEL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from nriv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table tab_nriv&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where object in s_object&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and TOYEAR &amp;lt; sy-datum+(4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at tab_nriv into wa_nriv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WA_NRIV-No_range = WA_NRIV-maxnumber - WA_NRIV-minnumber + 1 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wa_nriv-no_range is not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_nriv-useage = ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) /&lt;/P&gt;&lt;P&gt;WA_NRIV-No_range ) * 100 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if wa_nriv-No_range  &amp;lt;&amp;gt; -1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c = ( ( wa_nriv-currentnumber - wa_nriv-minnumber + 1 ) / (&lt;/P&gt;&lt;P&gt;wa_nriv-No_range + 1 ) ).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if c &amp;lt;&amp;gt; 1.&lt;/P&gt;&lt;P&gt;d = ( c  / ( 1 - c ) ).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if d is not initial.&lt;/P&gt;&lt;P&gt;wa_nriv-M_dooms = 50 / d.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify tab_nriv from wa_nriv transporting No_range useage M_dooms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;jana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Oct 2008 06:47:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-compute-bcd-overflow/m-p/4546137#M1073699</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-08T06:47:41Z</dc:date>
    </item>
  </channel>
</rss>

