Skip to Content

Exception Class Heirarchy

Hi Experts,

SAP implemented exception classes to capture exceptions. CX_ROOT acts as root class for all Exception Class.

Tracking which exception can be raised by a class is easy since it is defined the definition but how about procedural language. example in case of SQL Statement, Read table etc...

Try.

E.g. Select ABCD from ABCD where (dynamic clause).

Catch <CX_????>

Endtry.

Is there some document which maps exception raised by non-oops part of ABAP. If not how to find which all possible exceptions can be raised.


Thanks,

Chirantan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Oct 22, 2012 at 06:36 PM

    Hello Chirantan,

    the exceptions directly triggered from the ABAP commands are different to the OO-Exceptions and even different to the classic exceptions.

    Indeed, ABAP has no less the 3 exception mechanisms...🤯

    The ones of the ABAP commands are system exceptions and behave mostly like dynamic OO exceptions, i. e. the compiler does not check them.

    The only possibility to find out which ones are thrown by a specific command is the documentation or trial and error.

    Regards,

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Chirantan,

      To my knowledge,

      [OLD Exception concept]

      System-exception are raised by (ofcourse) system and if not caught in try.. catch block then 'runtime error' ( = dump ) occurs.

      classical exceptions are something raised by 'raise exception' syntax and if the caller can handle them through 'sy-subrc'..,

      Both are still 'Exceptions'!

      [NEW OO Exception concept and System-exceptions]

      every system-exception has now OO equivalent exception..both old and new exceptions exists in parallel!

      these system-exceptions fall under category 'CX_DYNAMIC_CHECK' of OO Exceptions..

      In above example given by Felipe, OO Exception CX_SY_OPEN_SQL_DB is equivalent to (old) multiple system-exceptions e.g. DBIF_RSQL_SQL_ERROR, DBIF_RSQL_INVALID_RSQL etc..

      You can get the actual 'Runtime error ID' (i.e. old system-exception text) which caused the exception as a attribute 'KERNEL_ERRID' of the OO Exception (It is availble from the root exception cx_root).. i.e. mapping of system-exception to OO exception..

      I hope it helps in clarification..

      Best Regards,

      Abhijit

  • Posted on Oct 18, 2012 at 07:36 PM

    I've found that most of the time the Documentation for a statement (F1-Help on the keyword) will tell what exceptions a statement can raise. Although I see your point, the only mention of a dynamic sql exception I see is in the example. It would be nice to have a more reliable source for this information. Also, props to you for attempting robust error handling! 😊

    TRY.
    SELECT SINGLE *
    FROM spfli
    INTO spfli_wa
    WHERE (cond_syntax).
    CATCH cx_sy_dynamic_osql_error.
    MESSAGE `Wrong WHERE condition!` TYPE 'I'.
    ENDTRY.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2012 at 11:33 AM

    As Alex said, you could find the exception classes avaialable in the sap help (F1), as example for Open SQL:

    CX_SY_OPEN_SQL_DB

    CX_SY_DYNAMIC_OSQL_SEMANTICS

    CX_SY_DYNAMIC_OSQL_SYNTAX


    imagem.GIF (24.0 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.