RFC
RFC-enabled function modules let ABAP code be called remotely, from another SAP system or an external program, and let ABAP call out to other systems. Building and calling RFCs is core to SAP integration development.
When you build an RFC for others to call, use flat, well-documented parameters, return status/messages clearly, and consider reliability (tRFC/qRFC for guaranteed, ordered delivery).
- A function module flagged as "Remote-Enabled" can be invoked across systems via RFC.
- Remote calls use an RFC destination (defined in SM59) naming the target system and logon.
- Building and calling RFCs is core to SAP integration development.
- Watch out: Not handling RFC exceptions (system down/unreachable).
Remote-enabled function modules
A function module flagged as "Remote-Enabled" can be invoked across systems via RFC. This is how SAP exposes callable logic to other SAP systems and to external programs (through connectors/SDKs). BAPIs are, technically, specially-defined remote-enabled function modules.
Calling a remote function
CALL FUNCTION 'Z_GET_CUSTOMER' DESTINATION 'RFC_TARGET'
EXPORTING iv_kunnr = lv_kunnr
IMPORTING es_data = ls_data
EXCEPTIONS communication_failure = 1 system_failure = 2 OTHERS = 3.
IF sy-subrc <> 0. " handle RFC error
ENDIF.Destinations and error handling
Remote calls use an RFC destination (defined in SM59) naming the target system and logon. Robust code always handles the communication_failure/system_failure exceptions, remote systems can be down or unreachable, and RFC errors are among the most common integration issues.
Designing remote-enabled FMs
When you build an RFC for others to call, use flat, well-documented parameters, return status/messages clearly, and consider reliability (tRFC/qRFC for guaranteed, ordered delivery). Good interface design here makes integrations robust.
Common pitfalls
- Not handling RFC exceptions (system down/unreachable).
- Wrong or missing destination (SM59).
- Complex parameters that are hard to call remotely.