<?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: exception class text use message class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173340#M1979162</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;CLASS zcx_blabla DEFINITION
  PUBLIC
  INHERITING FROM cx_static_check
  FINAL
  CREATE PUBLIC .


  PUBLIC SECTION.
    INTERFACES if_t100_dyn_msg .
    INTERFACES if_t100_message .


    CONSTANTS:
      BEGIN OF fail_to_...,
        msgid TYPE symsgid VALUE '00',
        msgno TYPE symsgno VALUE '398',
        attr1 TYPE scx_attrname VALUE 'GV_PARAMETER1',
        attr2 TYPE scx_attrname VALUE '',
        attr3 TYPE scx_attrname VALUE '',
        attr4 TYPE scx_attrname VALUE '',
      END OF fail_to_... .

  data GV_PARAMETER1 type string.




    METHODS constructor
      IMPORTING
        !textid              LIKE if_t100_message=&amp;gt;t100key OPTIONAL
        !previous            LIKE previous OPTIONAL
        iv_parameter1        TYPE string OPTIONAL.
endclass.




class zcx_blabla implementation.

  METHOD constructor ##ADT_SUPPRESS_GENERATION.
    CALL METHOD super-&amp;gt;constructor
      EXPORTING
        previous = previous.
 gv_parameter1 = iv_parameter1.
endmethod.
endclass.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to be able to push parameters to the exception class.&lt;/P&gt;&lt;P&gt;and when you will use it&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;raise exception type zcx_blabla 
exporting 
textid = zcx_blabla=&amp;gt;failed_to_...
iv_parameter1 = "whateveryouwant. &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 May 2020 13:14:33 GMT</pubDate>
    <dc:creator>FredericGirod</dc:creator>
    <dc:date>2020-05-19T13:14:33Z</dc:date>
    <item>
      <title>exception class text use message class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173336#M1979158</link>
      <description>&lt;P&gt;Good day all. I have created a custom exception class which extends from CX_STATIC_CHECK. Under properties I specified a custom message class under general data in message class field. I want to display the text from the custom message class in the class texts when I throw a message as opposed to specifying the text directly in the class. How do I do that? Thanks in advance. &lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 11:22:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173336#M1979158</guid>
      <dc:creator>former_member609989</dc:creator>
      <dc:date>2020-05-19T11:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: exception class text use message class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173337#M1979159</link>
      <description>&lt;P&gt;Is that what you're looking for ? Or could you clarify your question please?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TRY.
    ...
  CATCH zcx_... INTO DATA(exception).
    DATA(text) = exception-&amp;gt;GET_TEXT( ).
ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 May 2020 11:51:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173337#M1979159</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-05-19T11:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: exception class text use message class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173338#M1979160</link>
      <description>&lt;P&gt;Hi Sandra. Thanks very much for your help. I've created an exception class and specified a custom message class to be used with that class under properties. If I do this does it mean I don't have to specify any texts or text symbols in the class? Also...how do I throw the exception and specify the appropriate message id from the message class in the textid attribute on raising the exception? &lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 12:09:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173338#M1979160</guid>
      <dc:creator>former_member609989</dc:creator>
      <dc:date>2020-05-19T12:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: exception class text use message class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173339#M1979161</link>
      <description>&lt;P&gt;You do not need to explicitly "reference" the message class you want to consume text from from the exception class. You specify the message at the time when the exception is thrown.&lt;/P&gt;&lt;P&gt;Given you created the exception class with flag &lt;EM&gt;With Message Class &lt;/EM&gt;ticked syntax is &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RAISE EXCEPTION TYPE zcx_test MESSAGE e001(zmessages) WITH 'This' 'is' 'a' 'test'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(system release 7.52+)  or&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA textid TYPE scx_t100key.

textid-msgid = 'ZMESSAGES'.
textid-msgno = '001'.
textid-attr1 = 'This'.
textid-attr2 = 'is'.
textid-attr3 = 'a'.
textid-attr4 = 'test'.

RAISE EXCEPTION TYPE zcx_test
  EXPORTING
    textid = textid.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(also for lower releases)&lt;/P&gt;&lt;P&gt;The message class on the properties tab servers a different purpose.&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 13:01:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173339#M1979161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2020-05-19T13:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: exception class text use message class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173340#M1979162</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;CLASS zcx_blabla DEFINITION
  PUBLIC
  INHERITING FROM cx_static_check
  FINAL
  CREATE PUBLIC .


  PUBLIC SECTION.
    INTERFACES if_t100_dyn_msg .
    INTERFACES if_t100_message .


    CONSTANTS:
      BEGIN OF fail_to_...,
        msgid TYPE symsgid VALUE '00',
        msgno TYPE symsgno VALUE '398',
        attr1 TYPE scx_attrname VALUE 'GV_PARAMETER1',
        attr2 TYPE scx_attrname VALUE '',
        attr3 TYPE scx_attrname VALUE '',
        attr4 TYPE scx_attrname VALUE '',
      END OF fail_to_... .

  data GV_PARAMETER1 type string.




    METHODS constructor
      IMPORTING
        !textid              LIKE if_t100_message=&amp;gt;t100key OPTIONAL
        !previous            LIKE previous OPTIONAL
        iv_parameter1        TYPE string OPTIONAL.
endclass.




class zcx_blabla implementation.

  METHOD constructor ##ADT_SUPPRESS_GENERATION.
    CALL METHOD super-&amp;gt;constructor
      EXPORTING
        previous = previous.
 gv_parameter1 = iv_parameter1.
endmethod.
endclass.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to be able to push parameters to the exception class.&lt;/P&gt;&lt;P&gt;and when you will use it&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;raise exception type zcx_blabla 
exporting 
textid = zcx_blabla=&amp;gt;failed_to_...
iv_parameter1 = "whateveryouwant. &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 May 2020 13:14:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/exception-class-text-use-message-class/m-p/12173340#M1979162</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2020-05-19T13:14:33Z</dc:date>
    </item>
  </channel>
</rss>

