This statement can only be used in the declaration part of a class. It defines the private
of the class
class. All components of the class defined in the section behind the
PRIVATE SECTION statement can only be addressed in the class itself, and in its
- The class is the smallest encapsulation unit in ABAP Objects. This means that a method can use all private components of all instances of the same class, apart from the private components of its own class. An exception to this rule are subclasses that cannot access the private components of superclasses, if they are not their friends.
- The declaration of attributes in the private section does not stop methods of the References class from declaring externally to these attributes in the form of reference variables or field symbol, and therefore making the attributes visible and modifiable outside the private section.
- Private components declared in a class but not used statically there produce a warning in the extended program check.
Private attributes are the only attributes for which the declaration of the addition
READ ONLYis not required and therefore can not be specified.
See Visibility Sections.