sapdev logo background
sapdev logo sapdev logo
Comments

ABAP PRIVATE Statement syntax, information and example SAP source code



Return to Statement index



PRIVATE SECTION

ABAP Syntax PRIVATE SECTION.

What does it do? This statement can only be used in the declaration part of a class. It defines the private visibility section 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 friends .

Latest notes: 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 ONLY is not required and therefore can not be specified.
Example ABAP Coding See Visibility Sections .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




PRINT-CONTROL_OBSOLETE
PROGRAM




comments powered by Disqus