<?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 Runtime error in abap report in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701899#M1452462</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 facing a problem when i am executing the report for a purticular materail type,it is giving the below mentioned error and when i execute it for a some materails it is displaying the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to remove it....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

 An exception occurred that is explained in detail below.
 The exception, which is assigned to class 'CX_SY_ZERODIVIDE', was not caught  and therefore caused a runtime error.
 The reason for the exception is:

 In the current program "ZNEW04", an arithmetic operation ('DIVIDE', '/', 'DIV' or 'MOD') with a type P operand attempted to divide
 by 0.


      IF W_TAB1-MEINS = 'G'.
            W_FINAL-TOTWT = W_TAB1-LBKUM / 1000000.
      ELSEIF W_TAB1-MEINS = 'KG'.
            W_FINAL-TOTWT = W_TAB1-LBKUM / 1000.
      ELSEIF W_TAB1-MEINS &amp;lt;&amp;gt; 'TO'.
            W_FINAL-TOTWT = W_TAB1-LBKUM * W_TAB1-WTKG / 1000.
      ENDIF.

              W_FINAL-TOTWT1 = W_FINAL-SALK3  / W_FINAL-LBKUM.
--&amp;gt; (Error occur here)        W_FINAL-TOTWT2 = W_FINAL-SALK3  / W_FINAL-TOTWT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 06 Mar 2010 09:04:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-03-06T09:04:57Z</dc:date>
    <item>
      <title>Runtime error in abap report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701899#M1452462</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 facing a problem when i am executing the report for a purticular materail type,it is giving the below mentioned error and when i execute it for a some materails it is displaying the output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to remove it....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

 An exception occurred that is explained in detail below.
 The exception, which is assigned to class 'CX_SY_ZERODIVIDE', was not caught  and therefore caused a runtime error.
 The reason for the exception is:

 In the current program "ZNEW04", an arithmetic operation ('DIVIDE', '/', 'DIV' or 'MOD') with a type P operand attempted to divide
 by 0.


      IF W_TAB1-MEINS = 'G'.
            W_FINAL-TOTWT = W_TAB1-LBKUM / 1000000.
      ELSEIF W_TAB1-MEINS = 'KG'.
            W_FINAL-TOTWT = W_TAB1-LBKUM / 1000.
      ELSEIF W_TAB1-MEINS &amp;lt;&amp;gt; 'TO'.
            W_FINAL-TOTWT = W_TAB1-LBKUM * W_TAB1-WTKG / 1000.
      ENDIF.

              W_FINAL-TOTWT1 = W_FINAL-SALK3  / W_FINAL-LBKUM.
--&amp;gt; (Error occur here)        W_FINAL-TOTWT2 = W_FINAL-SALK3  / W_FINAL-TOTWT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Mar 2010 09:04:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701899#M1452462</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-06T09:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error in abap report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701900#M1452463</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;PRE&gt;&lt;CODE&gt;As a general Rule whenever you devide you need check that you are not deviding it by zero
5 / 0 is inifinity but in SAP it give run time error Hope this is clear to you.

so before deviding you need to chek it 

if not W_FINAL-LBKUM = 0. " or '0.00' if packed decimal
           W_FINAL-TOTWT1 = W_FINAL-SALK3  / W_FINAL-LBKUM.
endif.
if not W_FINAL-TOTWT  = 0. " or '0.00' If packed decimal
      W_FINAL-TOTWT2 = W_FINAL-SALK3  / W_FINAL-TOTWT.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheerz&lt;/P&gt;&lt;P&gt;Ram&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Mar 2010 09:13:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701900#M1452463</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-06T09:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Runtime error in abap report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701901#M1452464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This is a Simple Arithmatic Error &lt;STRONG&gt;Divide By Zero&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here due to some reason a field  &lt;STRONG&gt;W_FINAL-TOTWT&lt;/STRONG&gt; contain 0 value.&lt;/P&gt;&lt;P&gt;Mean  &lt;STRONG&gt;W_FINAL-TOTWT EQ 0&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So debug your code and make a validation that if  &lt;STRONG&gt;W_FINAL-TOTWT&lt;/STRONG&gt; GT 0 only then devision occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way dump will not occur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Mar 2010 09:16:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/runtime-error-in-abap-report/m-p/6701901#M1452464</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-06T09:16:22Z</dc:date>
    </item>
  </channel>
</rss>

