sapdev logo background
sapdev logo sapdev logo
Comments

Class Constructor method of an SAP class




A CLASS CONSTRUCTOR method is a method that is automatically called when the class is being used i.e. just before the first instance of the class is created. Within here you can therefore create default data and populate static attributes that are required by the class. These values will then always be available for use by the class and its methods. There is also a CONSTRUCTOR method which works in a similar way but is called each time an instance of a class is created.

In-order to create a class constructor simply open up your class within your prefered SAP transaction such as SE80 and click in the 'Class Constructor' button within the application toolbar.


This will then create a constructor class for you


Double click on this methoid name and you can add any code you like which could retrieve data and/or populate any available attributes etc...




comments powered by Disqus