<?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 Get the values from Exception class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024056#M414632</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In class i have raised one exception&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i catch this exception in my program i m able to get the &lt;/P&gt;&lt;P&gt;error message but i need to get all the parameters that i pass &lt;/P&gt;&lt;P&gt;when i raise the exception ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have raised like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RAISE EXCEPTION TYPE cx_bapi_error&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;textid = cx_bapi_error=&amp;gt;cx_bo_error&lt;/P&gt;&lt;P&gt;class_name = 'ZHS_'&lt;/P&gt;&lt;P&gt;log_no = wa_bapi_return-log_no&lt;/P&gt;&lt;P&gt;log_msg_no = wa_bapi_return-log_msg_no&lt;/P&gt;&lt;P&gt;t100_msgid = wa_bapi_return-id&lt;/P&gt;&lt;P&gt;t100_msgno = wa_bapi_return-number&lt;/P&gt;&lt;P&gt;t100_msgv1 = wa_bapi_return-message_v1&lt;/P&gt;&lt;P&gt;t100_msgv2 = wa_bapi_return-message_v2&lt;/P&gt;&lt;P&gt;t100_msgv3 = wa_bapi_return-message_v3&lt;/P&gt;&lt;P&gt;t100_msgv4 = wa_bapi_return-message_v4&lt;/P&gt;&lt;P&gt;STATUS = lt_status&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and caught the exception like this in my program &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CATCH cx_bapi_error INTO go_error.&lt;/P&gt;&lt;P&gt;gd_text = go_error-&amp;gt;get_text( ).&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this i m just getting the class name which i have passed in exception&lt;/P&gt;&lt;P&gt;i need all other parameters that i have passed ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u have any idea pls let me know ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Mar 2007 10:59:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-16T10:59:34Z</dc:date>
    <item>
      <title>Get the values from Exception class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024056#M414632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In class i have raised one exception&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i catch this exception in my program i m able to get the &lt;/P&gt;&lt;P&gt;error message but i need to get all the parameters that i pass &lt;/P&gt;&lt;P&gt;when i raise the exception ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have raised like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RAISE EXCEPTION TYPE cx_bapi_error&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;textid = cx_bapi_error=&amp;gt;cx_bo_error&lt;/P&gt;&lt;P&gt;class_name = 'ZHS_'&lt;/P&gt;&lt;P&gt;log_no = wa_bapi_return-log_no&lt;/P&gt;&lt;P&gt;log_msg_no = wa_bapi_return-log_msg_no&lt;/P&gt;&lt;P&gt;t100_msgid = wa_bapi_return-id&lt;/P&gt;&lt;P&gt;t100_msgno = wa_bapi_return-number&lt;/P&gt;&lt;P&gt;t100_msgv1 = wa_bapi_return-message_v1&lt;/P&gt;&lt;P&gt;t100_msgv2 = wa_bapi_return-message_v2&lt;/P&gt;&lt;P&gt;t100_msgv3 = wa_bapi_return-message_v3&lt;/P&gt;&lt;P&gt;t100_msgv4 = wa_bapi_return-message_v4&lt;/P&gt;&lt;P&gt;STATUS = lt_status&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and caught the exception like this in my program &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CATCH cx_bapi_error INTO go_error.&lt;/P&gt;&lt;P&gt;gd_text = go_error-&amp;gt;get_text( ).&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDTRY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this i m just getting the class name which i have passed in exception&lt;/P&gt;&lt;P&gt;i need all other parameters that i have passed ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u have any idea pls let me know ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2007 10:59:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024056#M414632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-16T10:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Get the values from Exception class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024057#M414633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jayakumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the exception class, under attributes create instance attributes with the same name as you are passing from the program (class_name, log_no etc) under raising statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the cx_bo_error exception text, add the attributes between &amp;amp;&amp;amp; (e.g. &amp;amp;class_name&amp;amp;, &amp;amp;log_no&amp;amp;)  in the order you want them to be displayed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Award points if found useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Indrajit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2007 13:49:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024057#M414633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-16T13:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get the values from Exception class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024058#M414634</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 would create private class attributes for all your parameters. Set the attributes in the constructor of your exception. Then create getter methods for the different parameters. This makes it very easy to access the parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2007 14:22:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024058#M414634</guid>
      <dc:creator>thomasalexander_ritter</dc:creator>
      <dc:date>2007-03-16T14:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get the values from Exception class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024059#M414635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jayakumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually the attributes of standard exception classes are defines as &amp;lt;b&amp;gt;public&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;read-only&amp;lt;/b&amp;gt;. Thus, you should be able to use the following coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  go_error   TYPE REF TO cx_bapi_error.  " specific exception class !!!

TRY.
RAISE EXCEPTION TYPE cx_bapi_error
EXPORTING
textid = cx_bapi_error=&amp;gt;cx_bo_error
class_name = 'ZHS_'
log_no = wa_bapi_return-log_no
log_msg_no = wa_bapi_return-log_msg_no
t100_msgid = wa_bapi_return-id
t100_msgno = wa_bapi_return-number
t100_msgv1 = wa_bapi_return-message_v1
t100_msgv2 = wa_bapi_return-message_v2
t100_msgv3 = wa_bapi_return-message_v3
t100_msgv4 = wa_bapi_return-message_v4
STATUS = lt_status.

CATCH cx_bapi_error INTO go_error.
gd_text = go_error-&amp;gt;get_text( ).

WRITE: go_error-&amp;gt;t100_msgid,  " perhaps the attributes have different name
            go_error-&amp;gt;t100_msgno, " check attribute names in SE24
            ...
EXIT.
ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2007 14:38:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/get-the-values-from-exception-class/m-p/2024059#M414635</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-03-16T14:38:59Z</dc:date>
    </item>
  </channel>
</rss>

