SAP INSTANCE CONSTRUCTOR - Guide
Get Example source ABAP code based on a different SAP table
Instance Constructor
ABAP_BACKGROUND
When you define an ABAP class, you specify who can create an instance of this class or who may access the instance constructor of the class. To do this, you use the addition
From a technical point of view, the instance constructor can be declared in all visibility sections that are more general or equal to the instantiation specified in the addition
ABAP_RULE
Always declare the instance constructor of a global class in its public visibility section and independently of the instantiation specified by the addition
ABAP_DETAILS
The components of global classes are stored internally separated according to the visibility section they belong to. Depending on the usage type of the class, only parts of the class are respected by ABAP Compiler in compilations. This procedure requires that the constructor of a global class is always declared in the public visibility section of the class. For these technical reasons, the instance constructor of a global class is always supposed to be declared in the public visibility section (
Exception
The technical restrictions mentioned only apply to the processing of global classes. Within local classes, the instance constructor can also be defined in other visibility sections and the positioning should correspond with the visibility section specified using the addition