‎2009 Jul 20 12:00 PM
Hello everyone,
Iu2019m playing around with this new-fashioned exception stuff called exception classes. To start with I want to create a common class that handles u201Cold schoolu201D exceptions of function modules.
This exception class should read the message from the syst fields automatically and return it later via (already existing interface) method GET_TEXT. Iu2019d like to avoid filling the message manually at the constructor, because I think this isnu2019t something that needs be implemented every time I use the exception, but rather be handled by the class itself. It would also be an advantage to get this done without any data definitions in the routine that invokes (RAISE EXCEPTION TYPE u2026) the exception!
Is there any way or best practice to achieve this without some intricate using of the TEXTID (of type IF_T100_MESSAGE=>T100KEY)?
I hope you can understand what Iu2019m trying to do!
Thanks in advance and kind regards,
Alej
‎2009 Nov 05 6:44 AM
Hi,
I am not really sure...but well if I understand you want the message to be in sy-* structure and raise the exception class...the best way to do is...
message XXX in l_dummy.
Raise exception type cx_***
now in exception class constructor or catch clause you can access sy-* structure to access the message.
I hope I cold answer this.
Regards,
Jemin Tanna
‎2010 Jun 21 4:55 PM
After a while I gave up and forgot about this
Someone has an idea one year later?
‎2010 Jun 22 1:51 PM
I'm currently doing something like this:
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO ld_message.
RAISE EXCEPTION TYPE zcx_exception EXPORTING text = ld_message.