Error Handling
Java |
The following errors can be handled by SAP Exchange Infrastructure:
· System errors, which are triggered by SAP Exchange Infrastructure. These might be errors during transfer, due to a failed server, for example.
· Application errors, which are triggered or handled by the application alone. An example would be a request for data about a material that is unknown in the receiver system.
Error handling is essentially of interest in the synchronous case. In this case, an application can report application errors to the caller application. In the asynchronous case, you can catch an error that has occurred during transfer and, on the inbound side, forward an error to monitoring.
You can catch errors that occur when a message is being transferred, using the exception class SystemFaultException, so that the system displays an error message.

The full name of the exception class for system errors is: com.sap.aii.proxy.xiruntime.core.SystemFaultException.
In the Integration Repository, you can define fault messages to handle application errors. The proxy generation functions then generate exception classes. Using fault messages, you can handle errors triggered by the called application:
Message Interface |
Error Handling Options |
Synchronous Communication (Inbound/Outbound) |
An exception is triggered at the receiver that is providing a service; the exception is handled by the sender that called the service. |
Asynchronous Inbound Interface |
Error handling is only possible using acknowledgements. The sender must request an acknowledgement message of type ApplicationError. If the application on the receiver side triggers an exception of type ApplicationFaultException, the Java proxy runtime sends a negative application acknowledgement to the receiver that contains the fault message. |
Exception classes for application errors are derived from the basis exception class ApplicationFaultException. You can use this exception class to determine an error situation, independently of the exact error, or in an else branch, you can use it to catch all the errors that have not yet been handled.

The full name of the exception class for application errors is: com.sap.aii.proxy.xiruntime.core.ApplicationFaultException.
...
1. To handle an application error, create fault messages for your message in the Integration Repository.
2. In each case, handle system errors, and, if necessary, application errors (see: Reporting and Handling Errors).