What is RFC? How do you make a function module remote-enabled, call it in another system, and test it?
Say your answer out loud first.
Practise another way
RFC, remote function call, is SAP's protocol for calling a function module in another system, or letting an external program call SAP. I set the processing type to remote-enabled in SE37, or to RFC in ADT, and type every parameter by value with dictionary types, because references cannot cross systems.
The caller needs an RFC destination in SM59 that points to one client with a logon user. Then I write CALL FUNCTION ... DESTINATION and handle SYSTEM_FAILURE and COMMUNICATION_FAILURE.
What RFC is Remote Function Call is SAP's standard interface between systems. It is bidirectional: ABAP calls function modules in other SAP systems, and external programs (through the RFC libraries and connectors) call SAP. BAPIs are RFC-enabled function modules that follow extra conventions.
Making a function module remote-enabled
- SE37: Attributes tab, processing type Remote-Enabled Module. In ADT: Properties view, Specific tab, processing type RFC, where you also define the RFC scope and RFC interface contract.
- Restrictions from the ABAP keyword documentation:
- IMPORTING, EXPORTING and CHANGING parameters must be pass by value (TABLES are handled implicitly).
- Types must come from the ABAP Dictionary or be predefined ABAP types; no type groups, no reference types.
- The module must not end the RFC session, so no LEAVE PROGRAM or SUBMIT without RETURN.
- Report business errors in a RETURN table rather than classic exceptions, so non-ABAP callers can read them.
The destination In SM59 you create an RFC destination: target host or load balancing, one client, and either a stored logon user or a prompt.
With trusted RFC, the calling system is trusted and the same user exists in both, so no password is sent. You can have several destinations to one system, each with a different user.
Calling it
CALL FUNCTION 'Z_STOCK_GET' DESTINATION 'ERP_CLNT100'
EXPORTING
iv_matnr = lv_matnr
IMPORTING
ev_qty = lv_qty
EXCEPTIONS
system_failure = 1 MESSAGE lv_msg
communication_failure = 2 MESSAGE lv_msg
OTHERS = 3.
IF sy-subrc <> 0.
" log lv_msg; decide on retry or error to the user
ENDIF.
Know the side effect: synchronous and asynchronous RFC trigger an implicit database commit in the caller (not during update processing), so never call them while a database cursor is open.
Testing SE37 test (F8) runs the module locally or against an RFC target. For BAPIs that need a commit, build a test sequence in SE37: the BAPI, then BAPI_TRANSACTION_COMMIT.
Today Classic RFC stays central on-premise. Toward the cloud, SAP S/4HANA Cloud Public Edition accepts only listed BAPIs via WebSocket RFC or Cloud Connector. ABAP Cloud development prefers released HTTP and OData APIs through communication arrangements.
Covers the processing type, pass-by-value and type restrictions, the SM59 destination with user and client, the call with SYSTEM_FAILURE and COMMUNICATION_FAILURE, and the implicit commit.
Says 'tick remote-enabled and you are done', forgets the destination and the system exceptions, or thinks references can be passed.
Leaving out the SYSTEM_FAILURE and COMMUNICATION_FAILURE exceptions: when the target is down the caller dumps instead of handling the error.
- Why can an RFC module not have reference parameters?
- What is a trusted RFC, and when would you use it?
- What happens to your open database cursor when you make an sRFC call?
- How would an external Java program call this module?
6 official pages and 4 prep guides. Confidence: high. Checked 2 Dec 2026.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Prep guide Gives the question.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.
- Official page Backs the answer.