Show TOC Start of Content Area

Procedure documentation Exception Handling  Locate the document in its SAP Library structure


In this area you will learn how to set up exception handling for SAP JRA. This description includes the information you need if you switch from the use of the Java Connector (JCo) to JRA.


If an error occurs during transaction handling (operations on LocalTrancation -> Begin/Commit/Rollback)  a LocalTransactionException is thrown.

For all other cases ResourceAdapterInternalException is thrown.

All thrown Exceptions are subclasses of ResourceException.

Proceed as follows:

      catch ResourceWarning first.

      then catch ResourceException  to distinguish between defined ABAP Exceptions and all the other exceptions.

If the application throws an exception which is defined in ABAP, it should throw  ResourceWarning with the text of the ABAP exception as defined in the function module.

Migration from JCo to JRA

The JRA exceptions – as well as JCo exceptions – are bundled in exception groups.

In a first step you should identify the corresponding groups.

For the migration from JCo (or RFC) to JRA, the following mapping of RFC/ JCo applies for SAP JRA:











Chained Exceptions

Since the J2EE Connector Architecture (JCA) 1.5 is part of J2EE 1.4, chained exceptions are supported. Using getCause() you will get the original exceptions.

Message Listener Interface ABAP-Java

If you need to pass additional information that corresponds to or derives from the ABAP message, you can construct


  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4


In case of defined exceptions, perform the following steps:

      create an exception

      enter all additional ABAP specific values

      pass it to the constructor of ResourceWarning.

In case of runtime exceptions, proceed as follows:

      create an exception JCoRuntimeException

      throw it directly or pass it to the constructor of EJBException or other runtime exceptions required by the environment.


The following example shows a description of  the supported message parameters for JCoRuntimeException and AbapException:


     * Creates an instance of the exception object with the specified message

     * and more information for ABAP messages

     * @param group: the error group

     * @param key:  error code to identify the error

     * @param message: the specified detail message.

     * @param messageClass: the specified ABAP message class.

     * @param messageType: the specified ABAP message type, e.g. 'A' or 'E'

     * @param messageNumber: the specified ABAP message number.

     * @param messageParameters: the specified ABAP message Parameters.


    public JCoException(int group, String key, String message,

String messageClass, char messageType,

                 String messageNumber, String[] messageParameters)






End of Content Area