IT CanvassTalk to an advisor
SAP ABAP development · LessonReviewed by Anitha M, SAP Trainer, 13 yrs · Updated · Published · SAP S/4HANA 2023 · all levels

SAP ABAP 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.

Quick answer

A function module flagged remote-enabled can be called from another system with CALL FUNCTION and a DESTINATION defined in SM59, and BAPIs are a specially defined kind. Always handle the communication_failure and system_failure exceptions, since the remote system can be down. When building one for others, use flat, documented parameters and choose tRFC or qRFC for guaranteed, ordered delivery.

Key takeaways
  • 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.
Already working on SAP and stuck on a live ticket?Get an expert SAP developer on screen-share to finish your daily tasks with you. Deliver on time, protect your reputation and your job. Monthly support only, no task-wise plans.Task assigned · no idea where to startStill stuck · your job on the lineExpert joins your screenDelivered on timeExplore On Job Support