code pal for ABAP > Documentation > Number Attributes Check
The Number Attributes Check counts the number of attributes up to a maximum. If there are too many attributes in a class, it is probable that the single responsibility principle is violated.
This check counts only DATA
and CLASS-DATA
within a global or local, CLASS DEFINITION
or INTERFACE
. Inherited attributes and all constants are not counted. A structure is counted as one attribute, no matter how many attributes are in the structure.
Split the class or interface into multiple classes or interfaces which then contain less attributes. If there are many attributes related to one task, it's possible to group the attributes in structures.
You can suppress Code Inspector findings generated by this check using the pseudo comment "#EC NUMBER_ATTR
.
The pseudo comment must be placed right after the class definition header.
CLASS class_name DEFINITION. "#EC NUMBER_ATTR
DATA data_1 TYPE t1.
DATA data_2 TYPE t1.
CLASS-DATA class_data_1 TYPE t1.
ENDCLASS.