Handle System and Communication Failures in Remote Function Calls (RFC)
ErrorSecurity & Robustness#EC NO_RFC_ERRRemote Enabled
Overview
RFC calls must handle system failures.
ATC Finding Message:
RFC call must handle SYSTEM_FAILURE and COMMUNICATION_FAILURE
Rationale
When invoking remote SAP systems via CALL FUNCTION ... DESTINATION, network timeouts, gateway unreachability, target kernel crashes, and authorization rejections trigger classic exceptions COMMUNICATION_FAILURE and SYSTEM_FAILURE. Omitting these exception handlers causes the local caller to crash with an unhandled short dump (CALL_FUNCTION_NOT_FOUND or RFC_COMMUNICATION_ERROR).
Reliability Standard: Always catch and log both COMMUNICATION_FAILURE and SYSTEM_FAILURE with MESSAGE lv_msg when calling remote destinations.
Non-Compliant
abap
" Fragile: Network glitch crashes the entire batch job with short dump
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
DESTINATION lv_rfcdest
EXPORTING
order_header_in = ls_header.Compliant
abap
" Resilient: Catches network and remote kernel failures gracefully
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
DESTINATION lv_rfcdest
EXPORTING
order_header_in = ls_header
EXCEPTIONS
communication_failure = 1 MESSAGE lv_comm_error
system_failure = 2 MESSAGE lv_sys_error
OTHERS = 3.
IF sy-subrc <> 0.
mo_logger->error( |Remote RFC failed: { lv_comm_error } { lv_sys_error }| ).
RAISE EXCEPTION NEW zcx_rfc_connection_failed( ).
ENDIF.Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_RFC_ERR
" SAP CI_ prefix format:
... "#EC CI_NO_RFC_ERRRelated Rules
- Avoid Kernel and Native Database Calls (SYSTEM-CALL, EXEC SQL) —
#EC NO_KERNEL_CALL - Avoid Dynamic Metaprogramming and Code Generation (Remote Code Execution Risk) —
#EC NO_METAPROGRAMMING - Provide FAILED and REPORTED in RAP EML Statements (Silent Transaction Failure Prevention) —
#EC NO_UNHANDLED_EML
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_RFC_ERR - Implementation File: zcl_skylint_no_rfc_err.clas.abap