Skip to content

Limit Type Fan-Out per Procedure ​

WarningMetrics & Complexity Limits#EC MAX_FANOUTLocal Only

Overview ​

Limit type fan-out per procedure.

ATC Finding Message: Procedure depends on too many distinct classes or interfaces

Rationale ​

A procedure that references many unrelated classes and interfaces is tightly coupled to a large part of the system, which makes it fragile and hard to test in isolation. Counting distinct kind = type references gives a lower-bound fan-out metric that never produces false positives: only types that actually appear in the procedure body are considered. Split responsibilities or introduce a facade when the number grows.

Non-Compliant ​

abap
DATA lo_a TYPE REF TO zcl_a.
DATA lo_b TYPE REF TO zcl_b.
DATA lo_c TYPE REF TO zcl_c.
DATA lo_d TYPE REF TO zcl_d.

Compliant ​

abap
DATA lo_service TYPE REF TO zif_order_service.
lo_service = mo_service_factory->create( ).

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault ValueDescription & Guidance
MAX_FANOUTInteger15Maximum allowed number of distinct class or interface types per procedure (default: 15)

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.