<?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: Comparing Objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986961#M952456</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Dec 2010 15:14:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-12-17T15:14:14Z</dc:date>
    <item>
      <title>Comparing Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986957#M952452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;  I have the following situation. Please help me how can i solve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I am catching the error into single exception class(&lt;/P&gt;&lt;P&gt;  data:lr_exception         TYPE REF TO cx_mdm_main_exception,.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     CATCH cx_mdm_usage_error    INTO lr_exception.&lt;/P&gt;&lt;P&gt;     CATCH cx_mdm_provider       INTO lr_exception.&lt;/P&gt;&lt;P&gt;     CATCH cx_mdm_kernel         INTO lr_exception.&lt;/P&gt;&lt;P&gt;     CATCH cx_mdm_server_rc_code INTO lr_exception.&lt;/P&gt;&lt;P&gt;     CATCH cx_mdm_not_supported  INTO lr_exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i will pass the lr_exception to some other varible for error handling. There i need to know which type of error it is like usage_error or proverder error or kernel error or something like as follow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If lr_exception type is cx_mdm_usage_error&lt;/P&gt;&lt;P&gt;      -&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;do something&lt;/P&gt;&lt;P&gt; elseif lr_exception type is  cx_mdm_provider&lt;/P&gt;&lt;P&gt;     -- do something&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; How to do this kind of checking. Please suggest me if you have the soultion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Best Regards,&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 13:51:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986957#M952452</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T13:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986958#M952453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see the code bellow:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA:
    vehicle type ref to vehicle,
    plane_ref type ref to plane,
    ship type ref to ship.

catch system-exceptions move_cast_error = 4.
  vehicle ?= i_ref.
endcatch.
if sy-subrc = 0.
  "working with vehicle
else.
  "not a vehicle
endif.
catch system-exceptions move_cast_error = 4.
  plane ?= i_ref.
endcatch.
if sy-subrc = 0.
  "working with plane
else.
  "not a plane
endif.
catch system-exceptions move_cast_error = 4.
  ship ?= i_ref.
endcatch.
if sy-subrc = 0.
  "working with ship
else.
  "not a ship
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This was extracted from the book &lt;STRONG&gt;ABAP Objects - An introduction to programming SAP applications&lt;/STRONG&gt; from &lt;STRONG&gt;Horst Keller and Sascha Krüger&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just change the catch mode to TRY and ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jun 2008 14:52:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986958#M952453</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-18T14:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986959#M952454</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;This should be simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In each exception class you can have a "static attribute" that defines the name of the class.&lt;/P&gt;&lt;P&gt;Now when you catch the exception you can determine which class it refers to by using this value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TRY.&lt;/P&gt;&lt;P&gt;      CASE lr_exception-&amp;gt;class_id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        WHEN (cx_mdm_usage_error).  -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&amp;gt; This can be a hardcoded value&lt;/P&gt;&lt;P&gt;          do something..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        WHEN (cx_mdm_provider).&lt;/P&gt;&lt;P&gt;         do something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        WHEN OTHERS.&lt;/P&gt;&lt;P&gt;          RAISE unsupported_object_type.&lt;/P&gt;&lt;P&gt;      ENDCASE.&lt;/P&gt;&lt;P&gt;  ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2008 09:40:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986959#M952454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-23T09:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986960#M952455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   This is the siplest way to handle all your exceptions.You should go through this code. You can easily understanding.If any queries, ask me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: l_exceptions TYPE REF TO CX_ROOT,&lt;/P&gt;&lt;P&gt;      l_excstring type string.&lt;/P&gt;&lt;P&gt;try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;catch l_exceptions into l_excstring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case l_excstring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN cx_mdm_usage_error. &lt;/P&gt;&lt;P&gt; do something..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN cx_mdm_provider.&lt;/P&gt;&lt;P&gt; do something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN cx_mdm_kernel&lt;/P&gt;&lt;P&gt; do something.&lt;/P&gt;&lt;P&gt;WHEN cx_mdm_server_rc_code.&lt;/P&gt;&lt;P&gt; do something.&lt;/P&gt;&lt;P&gt;WHEN cx_mdm_not_supported.&lt;/P&gt;&lt;P&gt; do something.&lt;/P&gt;&lt;P&gt;WHEN OTHERS.&lt;/P&gt;&lt;P&gt;   RAISE unsupported_object_type.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;ENDTRY.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it useful, reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Prasad G.V.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2008 16:38:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986960#M952455</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-23T16:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986961#M952456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Dec 2010 15:14:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comparing-objects/m-p/3986961#M952456</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-17T15:14:14Z</dc:date>
    </item>
  </channel>
</rss>

