<?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: Raise statement in Class method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867306#M1593440</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;Hope you are propagating the exception to the caller using the raising addition when you declare the method like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method A&lt;/P&gt;&lt;P&gt;  importing ..&lt;/P&gt;&lt;P&gt;  exporting ..&lt;/P&gt;&lt;P&gt;  raising ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the same should be caught in the calling program assigning the exception with a value as shown by Hüseyin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its best to use class based exceptions in OO context , easy to handle exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pawan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jun 2011 22:46:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-06-28T22:46:04Z</dc:date>
    <item>
      <title>Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867301#M1593435</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;In my function module ztest I create the instance of the class and execute a public method of the class. Upon encountering a certain condition in the class method I want the program flow to stop and return back to the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to raise an exception in the class method using .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;raise ENDING_RUN.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it gives a dump. How do I propagate control back to the function module from the class method when an if condition is met.&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, 14 May 2011 17:02:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867301#M1593435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-14T17:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867302#M1593436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vighneswaran ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you defined the exception from the exceptions tab ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't , you'll get a short dump as explained below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the exception is triggered in a method or function module whose caller does not assign a return value to the exception, a runtime error is then triggered whose short dump contains the name of the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you define exception , it will appear at the exceptions part of the FM pattern and sy-subrc set to related code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'ZZ_TEST'
 EXCEPTIONS
   ENDING_RUN  = 1
   OTHERS        = 2
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 May 2011 18:00:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867302#M1593436</guid>
      <dc:creator>huseyindereli</dc:creator>
      <dc:date>2011-05-14T18:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867303#M1593437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi the dump occurs within the class method itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I call the classs method from with the function module ztest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inside ztest&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do a create object of the class object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call  object-&amp;gt;class_method.----&lt;/P&gt;&lt;HR originaltext="---------------" /&gt;&lt;P&gt;&amp;gt;from this method calls are made to various private methods.In one of the                                                                   private methods I raise an exception.(iit dumps thee)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect the program flow return back to the function module from which I am calling.But I a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am unable to achieve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dump analysis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;condition "END_RUN".&lt;/P&gt;&lt;P&gt;Since the exception was not intercepted by a superior program&lt;/P&gt;&lt;P&gt;in the hierarchy, processing was terminated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Short description of exception condition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I intercept this exception within my function module .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vighneswaran CE on May 14, 2011 8:47 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 May 2011 18:12:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867303#M1593437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-14T18:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867304#M1593438</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;That dump means , you didn't catch the exception that was fired from somewhere in your code. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you raise an exception inside a method or function , it appears as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say , your method is any_method and you call it from a FM. You have to use;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;EXCEPTIONS
   ENDING_RUN  = 1
   OTHERS        = 2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;part if you dont want a short dump. If method fires ENDING_RUN exception than sy-subrc will be set to 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL METHOD go_object-&amp;gt;any_method
 IMPORTING 
  .....
EXPORTING
  ......
 EXCEPTIONS
   ENDING_RUN  = 1
   OTHERS        = 2.
IF sy-subrc EQ 1.
" ENDING_RUN fired.....
MESSAGE 'ENDING_RUN happened' TYPE 'E'.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 May 2011 09:29:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867304#M1593438</guid>
      <dc:creator>huseyindereli</dc:creator>
      <dc:date>2011-05-15T09:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867305#M1593439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition to Hüseyin's anwser, you need to define all exceptions which method can raise in its &lt;STRONG&gt;signature&lt;/STRONG&gt; . Go to method parameters -&amp;gt; choose button &lt;STRONG&gt;Exceptions&lt;/STRONG&gt; -&amp;gt; type in all exceptions there which you forseen the method will raise. Now, as long as you catch these exceptions (as suggested above) you won't get dump anymore. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of cource this applies to &lt;EM&gt;old exceptions&lt;/EM&gt; . It is adviced that you should use &lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/55/bff20efe8c11d4b54a006094b9456f/frameset.htm"&gt;class based exceptions&lt;/A&gt; instead, especially in OO context. From rasing and catching point of view for such exception the only things that change are:&lt;/P&gt;&lt;P&gt;- for raising: in methods signature where you typed your exceptions select chebox &lt;EM&gt;class exceptions&lt;/EM&gt; &lt;/P&gt;&lt;P&gt;- for catching: in calling unit use &lt;STRONG&gt;try - catch&lt;/STRONG&gt; block&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just refer the link I gave you and study a bit. It will become clear how you should use them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 May 2011 09:50:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867305#M1593439</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2011-05-15T09:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867306#M1593440</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;Hope you are propagating the exception to the caller using the raising addition when you declare the method like :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method A&lt;/P&gt;&lt;P&gt;  importing ..&lt;/P&gt;&lt;P&gt;  exporting ..&lt;/P&gt;&lt;P&gt;  raising ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the same should be caught in the calling program assigning the exception with a value as shown by Hüseyin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its best to use class based exceptions in OO context , easy to handle exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pawan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jun 2011 22:46:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867306#M1593440</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-28T22:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867307#M1593441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I only use class based exceptions now. (Which Function Modules can also raise, and Forms). They're so much easier to handle, and more powerful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jun 2011 08:33:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867307#M1593441</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2011-06-29T08:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Raise statement in Class method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867308#M1593442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for this you have to define in class definition.i.e,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class A definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;methods: m importing .......&lt;/P&gt;&lt;P&gt;                   exporting........&lt;/P&gt;&lt;P&gt;                   raising cx_root.&lt;/P&gt;&lt;P&gt;endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and you have to create object, parameters and then,&lt;/P&gt;&lt;P&gt;try.&lt;/P&gt;&lt;P&gt;call method object-&amp;gt;m&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;..........&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;catch cx_root&lt;/P&gt;&lt;P&gt;write:/  'exception raised;'.&lt;/P&gt;&lt;P&gt;endtry.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope this will helpful to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by,&lt;/P&gt;&lt;P&gt;pavan kumar.G&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 10:47:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/raise-statement-in-class-method/m-p/7867308#M1593442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-10-05T10:47:08Z</dc:date>
    </item>
  </channel>
</rss>

