Error Handling in RFC Server Programs.

This article will help is describing the common Netweaver RFC SDK return codes and error groups and their overview with solutions.

Return Code:

1) RFC_OK –> A function call was processed successfully.
2) RFC_COMMUNICATION_FAILURE –>The connection broke down while processing the function call. No response has been sent to the SAP system.
3) RFC_LOGON_FAILURE –> Unable to logon to SAP system. Invalid password, user locked, etc.
4) RFC_ABAP_RUNTIME_FAILURE –> SAP system runtime error: Short dump or the called function module raised an X Message
5) RFC_ABAP_MESSAGE –> A function call was started to be processed, but was aborted with an ABAP A- or E-Message within the implementing application. The message parameters have been returned to the SAP system (and can be evaluated there via the sy-msgid, sy-msgtype, sy-msgno, sy-msgv1, sy-msgv4 parameters).
6) RFC_ABAP_EXCEPTION –> A function call was processed and ended within the implementing application with a defined ABAP Exception, which has been returned to the SAP system.
7) RFC_CLOSED –> Connection closed by the other side.
8) RFC_CANCELED –> An RFC connection has been cancelled by the back end system.
9) RFC_TIMEOUT –> Time out
10) RFC_MEMORY_INSUFFICIENT –> Memory insufficient
11) RFC_VERSION_MISMATCH –> Version mismatch
12) RFC_INVALID_PROTOCOL –> The received data has an unsupported format.
13) RFC_SERIALIZATION_FAILURE –> A problem while serializing or de-serializing RFM parameters.
14) RFC_INVALID_HANDLE –> An invalid handle was passed to an API call.
15) RFC_RETRY –> Rfc Listen And Dispatch did not receive an RFC during the timeout period.
16) RFC_EXTERNAL_FAILURE –> Error in external customer code. (e.g. in the tRFC Handlers)
17) RFC_EXECUTED –> Inbound tRFC call already executed (needs to be returned from RFC_ON_CHECK_TRANSACTION in case the TID is already known).
18) RFC_NOT_FOUND –> Function or structure definition not found (Metadata API).
19) RFC_NOT_SUPPORTED –> The operation is not supported on that handle.
20) RFC_ILLEGAL_STATE –> The operation is not supported on that handle at the current point of time (e.g. trying a callback on a server handle, while not in a call)
21) RFC_INVALID_PARAMETER –> An invalid parameter was passed to an API call, (e.g. invalid name, type or length).
22) RFC_CODEPAGE_CONVERSION_FAILURE –> Code page conversion error.
23) RFC_CONVERSION_FAILURE –> Error while converting a parameter to the correct data type.
24) RFC_BUFFER_TOO_SMALL –> The given buffer was to small to hold the entire parameter. Data has been truncated.
25) RFC_TABLE_MOVE_BOF –> Trying to move the current position before the first row of the table.

RFC Error Groups:

1) OK –> OK
2) ABAP_APPLICATION_FAILURE –> ABAP Exception raised in ABAP function modules within the implementing application.
3) ABAP_RUNTIME_FAILURE –> ABAP Message raised in ABAP function modules or in ABAP runtime of the SAP system (e.g. Kernel).
4) LOGON_FAILURE –> Error message raised when logon fails.
5) COMMUNICATION_FAILURE –> Problems with the network connection (or SAP system broke down and killed the connection).
6) EXTERNAL_RUNTIME_FAILURE –> Problems in the RFC runtime of the external program (i.e. the present library)
7) EXTERNAL_APPLICATION_FAILURE –> Problems in the external program (e.g. in the external server implementation)

Common Error Causes:

There are different causes for ABAP errors, depending on the program. Causes include:
● Incorrect or incomplete entries in the RFC destination (transaction SM59)
● Network problems
● Authorization problems
● Error in the RFC program


Check the following:
1) Check all the entries made in transaction SM59. The destination used must be entered with category T. Enter a complete path name, if possible, for the program to be started. Make sure to save the destination.
2) Configuration on operating system level
a). The host name specification in the destination

i). A name is entered into ‘host name’ or a non-standard gateway is stored (in gateway options). In the latter case, the program is started by the standard gateway program of the system or by the gateway (gwrd) specified explicitly via ‘remote shell’.
Make sure that the entered computer can be addressed by the computer of gateway process. Enter the following command on this computer:
/etc/ping <host name> or ping <host name>.
To start a program with ‘remote shell’ on another computer, it is necessary that the user-ID of the gateway process exists on the target system and that the HOME directory of this user contains a file .r hosts in the target system. The name of the calling computer must be stored in this file. To test this, log in on the computer of the gateway process under the user-ID of this process and call the command:
remsh <host name> <program name>
In this case, you have to enter the same as in transaction SM59 for <host name> and <program name>.
(If an RFC server program is called without parameters, the call RfcRegisterServer returns an error code in any case and the program should terminate immediately.)

ii). No entry is made in ‘host name’
In this case, the program is started from the SAP application server.
○ Make sure that the program can be addressed from the SAP application server.
○ Make sure that the SAP application server has the authorization for starting the program.
○ To do this, log on under the user ID of the SAP application server. Go into the work directory of the application server (/usr/sap/…/D…/work), if possible, and start the RFC server program manually from there. (If an RFC server program is called without parameters, the call RfcRegisterServer returns an error code in any case and the program should terminate immediately.)

b. Problems in the RFC server program itself
To pick up stderr output of the RFC server program, you can enter a control program instead of the actual server program into the destination which in turn starts the actual server program with the same command line and which in this case redirects the standard output of the program into a file.

RFC server program is /xxx/xxxx.
However, the C script is called (do not forget the specification of the shell in the first line):
date >> /tmp/rfclog
/xxx/xxxx $* >>& /tmp/rfclog
echo $status >>& /tmp/rfclog
Display the log file /tmp/rfclog for further error analysis.

Leave a Reply

Your email address will not be published. Required fields are marked *