Basically, the use of class-based exception in the field of RFC takes place in the same way as with local function calls. There are however some details to note for remote function calls, as described in the sections below.
The most important difference is that class-based RFC exceptions are serialized for the transport from the server to the client program in basXML format (Binary ABAP Serialization XML). Therefore both the client side and the RFC destination have to support basXML.
Both the client and server are based on SAP NetWeaver 7.1 or higher.
Function call does not contain an EXCEPTION block.
The classic exception handling is used for function calls that contain an EXCEPTION block.
If a class-based exception is triggered on the server during classic exception handling then this causes a runtime error and the classic exception SYSTEM_FAILURE is returned at the client side.
The function module to be called is defined in the RFC Client. Restrictions
For releases < 7.11, all logon and authorization errors are mapped to exception class CX_REMOTE_APLL_ERROR. The error text is found in the MESSAGE_TEXT field.
If not system message fields are set for communicating with releases < 7.11 (for example, sy-msgty, sy-msgid, sy-msgno, sy-mgsv1,…,sy-msgv4), method GET_TEXT does not return a valid value in some cases for exception class CX_REMOTE_APLL_ERROR. The error text is found in the MESSAGE_TEXT field.
For class-based exception handling in your function call use TRY/CATCH syntax instead of the EXCEPTIONS block.
It is also possible to handle classic exceptions with class-based exception handling. There are however a few semantic considerations in the RFC field with regard to local function calls. For more information:
The following rules apply in certain cases when using asynchronous RFC calls. For further information, see:
You can find a more detailed description of local class-based exception handling in the ABAP field under: