SAP OO OBS EXCEPTIONS 1

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet
ARTICLE

Exceptions Must Be Defined in Triggering Class
In contrast to function modules, only those exceptions can be triggered in a method that have been defined for this method. The static syntax check checks whether the exception exists (when an exception is triggered by the statement RAISE and when it is handled using the exception EXCEPTIONS of the statement CALL METHOD ). A non-existent exception raised in a function module merely causes a syntax warning message, and handling of a non-existent exception in the statement CALL FUNCTION is not checked at all. Therefore undefined exceptions can be raised and handled in function modules.

Reason:

Runtime errors caused by triggering non-existent exceptions are prevented.