Skip to content

Avoid Concrete Class References in Interfaces ​

WarningClean ABAP & Modern Syntax#EC NO_INTF_CLASS_REFLocal Only

Overview ​

Interfaces should not reference concrete classes.

ATC Finding Message: Interface references concrete class; use an interface reference instead

Rationale ​

Interfaces should adhere to the Dependency Inversion Principle and not couple directly to concrete class implementations. Use interface references instead.

Non-Compliant ​

abap
INTERFACE lif_demo.
  DATA mo_obj TYPE REF TO cl_concrete.
ENDINTERFACE.

Compliant ​

abap
INTERFACE lif_demo.
  DATA mo_obj TYPE REF TO if_contract.
ENDINTERFACE.

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC NO_INTF_CLASS_REF

" SAP CI_ prefix format:
... "#EC CI_NO_INTF_CLASS_REF

Technical Details ​

Released under the MIT License.