<?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: Uncatchable runtime error on returning method call in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855688#M1886203</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's been some discussion in similar areas before - e.g. &lt;A __default_attr="3547506" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="How to catch BCD_OVERFLOW error when passing value to formal parameter?" href="https://community.sap.com/"&gt;&lt;/A&gt; and I recall another one where DO 1000000000000 TIMES triggered an uncatchable BCD_FIELD_OVERFLOW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's something to do with the way parameters are handled. It looks like the only workaround is to use helper variables, as you have done in your example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps &lt;A __default_attr="3984" __jive_macro_name="user" class="jive_macro_user jive_macro" data-objecttype="3" data-orig-content="Horst Keller" href="https://community.sap.com/"&gt;&lt;/A&gt; might know?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2015 11:38:51 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2015-01-28T11:38:51Z</dc:date>
    <item>
      <title>Uncatchable runtime error on returning method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855687#M1886202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;We are observing a strange error handling behavior on a "EHP6 FOR SAP ERP 6.0" system with SAP_BASIS release 740, SP-Level 0006.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are able to catch the runtime error/exception of an invalid type conversion if we do it within a method.&lt;/P&gt;&lt;P&gt;But we are not able to catch the same runtime error/exception when the conversion happens on a method's return value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a BCD_FIELD_OVERFLOW which is supposed to be catchable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the attached minimal program to reproduce the situation. You can also comment in the error handling lines in method same_error_leads_to_dump (either the ones with one asterisk or the ones with two asterisks) to confirm that the error is not handled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please keep in mind that our concern is not type conversion but error handling.&lt;/P&gt;&lt;P&gt;The corresponding real world scenario is a large parser dealing with many different fields.&lt;/P&gt;&lt;P&gt;Therefore we need to handle type conversion errors gracefully while we keep eliminating the causes one by one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone give me a hint how to handle this error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 11:13:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855687#M1886202</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-01-28T11:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Uncatchable runtime error on returning method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855688#M1886203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's been some discussion in similar areas before - e.g. &lt;A __default_attr="3547506" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="How to catch BCD_OVERFLOW error when passing value to formal parameter?" href="https://community.sap.com/"&gt;&lt;/A&gt; and I recall another one where DO 1000000000000 TIMES triggered an uncatchable BCD_FIELD_OVERFLOW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's something to do with the way parameters are handled. It looks like the only workaround is to use helper variables, as you have done in your example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps &lt;A __default_attr="3984" __jive_macro_name="user" class="jive_macro_user jive_macro" data-objecttype="3" data-orig-content="Horst Keller" href="https://community.sap.com/"&gt;&lt;/A&gt; might know?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 11:38:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855688#M1886203</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2015-01-28T11:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Uncatchable runtime error on returning method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855689#M1886204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something to tickle your grey cells &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.sap.com/1103/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I was never realised that the syntax checker doesn't check the type compatibility for RETURNING params. Anyway i read the SAP documentation for RETURNING params and apparently the type checking is different from them -&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;In the typing check,special rules apply, depending on whether an explicit actual parameter is bound with &lt;SPAN class="qtext"&gt;RECEIVING&lt;/SPAN&gt; or the functional method is used in an operand position.&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer - &lt;A href="http://help.sap.com/abapdocu_731/en/abentyping_return_values.htm" title="http://help.sap.com/abapdocu_731/en/abentyping_return_values.htm"&gt;ABAP Keyword Documentation&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't quite understand this part though &lt;SPAN __jive_emoticon_name="sad" __jive_macro_name="emoticon" class="jive_emote jive_macro" src="https://community.sap.com/1103/images/emoticons/sad.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Checking of this typing is not necessary (or is always successful). &lt;SPAN style="text-decoration: underline;"&gt;An error always occurs&lt;/SPAN&gt;, however, if the typing of the return value does not match the operand type.&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 12:18:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855689#M1886204</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2015-01-28T12:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Uncatchable runtime error on returning method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855690#M1886205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The answer is that it is a kind of missing functionality that it is on the agenda for an upcoming release.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As of Release 7.40, you can use the conversion operator &lt;STRONG&gt;CONV&lt;/STRONG&gt; in order to achieve the expected behavior: &lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;TYPES dec8 TYPE p LENGTH 8.&lt;BR /&gt;TYPES dec1 TYPE p LENGTH 1.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;CLASS demo DEFINITION.&lt;BR /&gt;&amp;nbsp; PUBLIC SECTION.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLASS-METHODS main RETURNING VALUE(p8) TYPE dec8.&lt;BR /&gt;ENDCLASS.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;CLASS demo IMPLEMENTATION.&lt;BR /&gt;&amp;nbsp; METHOD main.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p8 = 12345.&lt;BR /&gt;&amp;nbsp; ENDMETHOD.&lt;BR /&gt;ENDCLASS.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; DATA p1 TYPE dec1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRY.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "p1 = demo=&amp;gt;main( ).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p1 = &lt;STRONG&gt;CONV dec8( demo=&amp;gt;main( ) ).&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CATCH cx_sy_conversion_overflow.&lt;BR /&gt;&amp;nbsp; ENDTRY.&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before 7.40, you can use the trick to add a zero in another type in order to get the exception:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;START-OF-SELECTION.&lt;BR /&gt;&amp;nbsp; DATA p1 TYPE dec1.&lt;BR /&gt;&amp;nbsp; DATA df TYPE DECFLOAT34.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; TRY.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p1 = demo=&amp;gt;main( ) + df.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CATCH cx_sy_conversion_overflow.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; ENDTRY.&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The calculation type is decfloat34 and the exception occurs when assigning the result of the calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All in all clearly a missing feature. A functional mehtod call shouldn't behave differently than other expressions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 07:53:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855690#M1886205</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2015-01-29T07:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Uncatchable runtime error on returning method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855691#M1886206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Horst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know if there is a way to identify all affected lines by statical code analysis?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 12:34:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855691#M1886206</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-01-29T12:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Uncatchable runtime error on returning method call</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855692#M1886207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but I'm not too much an expert in that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jan 2015 14:24:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/uncatchable-runtime-error-on-returning-method-call/m-p/10855692#M1886207</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2015-01-29T14:24:10Z</dc:date>
    </item>
  </channel>
</rss>

