Skip to content

CALL_FUNCTION_REMOTE_ERROR

An RFC call failed at the network or system level before the remote function could execute.


Symptom

ST22 shows a short dump of type CALL_FUNCTION_REMOTE_ERROR. The call stack points to a CALL FUNCTION ... DESTINATION statement. No data was returned from the remote system.

CALL FUNCTION 'SOME_REMOTE_FM'
  DESTINATION 'MY_RFC_DEST'
  EXPORTING
    iv_param = lv_value.
" ^^^ dump occurs here when EXCEPTIONS are omitted

This is not a business error

CALL_FUNCTION_REMOTE_ERROR is a connection-level failure. It is distinct from a non-zero TYPE in a BAPI RETURN table or a custom exception inside the remote FM.


Cause

Root cause Details
RFC destination misconfigured Wrong host, port, system number, or client in SM59
Target system down Remote system is in maintenance, restarting, or unreachable
Network / firewall Port 33XX (dialog) or 48XX (HTTPS) blocked between systems
Missing credentials No logon data saved in SM59 for the destination
Timeout TIMEOUT parameter exceeded or network latency too high

Where to look first

Open SM59, select the destination, and click Connection Test / Authorization Test. The error text in SY-MSGV1 / SY-MSGV2 usually names the exact failure reason.


Reproduce

" Triggers the dump when the destination is unreachable and
" COMMUNICATION_FAILURE / SYSTEM_FAILURE are not declared.
CALL FUNCTION 'RFC_PING'
  DESTINATION 'BROKEN_DEST'.

Fix

Always declare COMMUNICATION_FAILURE and SYSTEM_FAILURE in the EXCEPTIONS block of every remote FM call. Read SY-MSGV1/SY-MSGV2 for the error detail.

DATA lv_msg TYPE string.

CALL FUNCTION 'SOME_REMOTE_FM'
  DESTINATION 'MY_RFC_DEST'
  EXPORTING
    iv_param         = lv_value
  EXCEPTIONS
    communication_failure = 1 MESSAGE lv_msg
    system_failure        = 2 MESSAGE lv_msg
    OTHERS                = 3.

CASE sy-subrc.
  WHEN 0.
    " success
  WHEN 1.
    MESSAGE |RFC communication failure: { lv_msg }| TYPE 'E'.
  WHEN 2.
    MESSAGE |Remote system failure: { lv_msg }| TYPE 'E'.
  WHEN OTHERS.
    MESSAGE 'Unexpected RFC exception' TYPE 'E'.
ENDCASE.

Inspecting the error message

After the call, SY-MSGV1 through SY-MSGV4 contain the RFC error detail. lv_msg (populated via MESSAGE lv_msg) is a ready-to-display string.


Prevention

  • Never omit COMMUNICATION_FAILURE and SYSTEM_FAILURE for any CALL FUNCTION ... DESTINATION statement.
  • Implement retry logic for transient failures (e.g., momentary network drops).
" Minimal retry pattern
DATA lv_attempts TYPE i VALUE 0.
DATA lv_success  TYPE abap_bool VALUE abap_false.

WHILE lv_attempts < 3 AND lv_success = abap_false.
  ADD 1 TO lv_attempts.

  CALL FUNCTION 'SOME_REMOTE_FM'
    DESTINATION 'MY_RFC_DEST'
    EXCEPTIONS
      communication_failure = 1 MESSAGE lv_msg
      system_failure        = 2 MESSAGE lv_msg
      OTHERS                = 3.

  IF sy-subrc = 0.
    lv_success = abap_true.
  ENDIF.
ENDWHILE.
  • Monitor RFC workload and errors via SM59 (destination config) and SMGW (gateway monitor).
  • Use RFC destinations (SM59) rather than hard-coded host/port strings — credentials and endpoints are managed centrally.

qRFC / tRFC

For queued or transactional RFC (CALL FUNCTION ... IN BACKGROUND TASK), also handle errors via SM58 (tRFC monitor) since exceptions are not raised synchronously.


See also

  • RFC_READ_TABLE function module
  • SAP Note 353597 — common causes of CALL_FUNCTION_REMOTE_ERROR
  • Transaction SM59 — RFC destinations
  • Transaction SMGW — gateway monitor

Comments