<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: CONSTRUCTORS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717553#M894937</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The full form of OOPS is object oriented programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Implicitly, each class has an instance constructor method with the reserved name constructor and a static constructor method with the reserved name class_constructor. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT statement, while the class constructor is executed exactly once before you first access a class. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The constructors are always present. However, to implement a constructor you must declare it explicitly with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no parameters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to start from scratch go to transaction abapdocu which will help u in learning on ur own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also refer to this link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/OO/defn.htm" target="test_blank"&gt;http://www.erpgenie.com/abap/OO/defn.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;imran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 03 May 2008 13:24:10 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-03T13:24:10Z</dc:date>
    <item>
      <title>CONSTRUCTORS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717550#M894934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello sap gurus,&lt;/P&gt;&lt;P&gt;           can any one tell me why we use the constructors in oops concept ?&lt;/P&gt;&lt;P&gt;what is the full form of oops ?&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 May 2008 12:54:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717550#M894934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-03T12:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: CONSTRUCTORS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717551#M894935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;refer the below mentioned link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_community" href="https://community.sap.com/" __jive_macro_name="community" modifiedtitle="true" __default_attr="2015"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 May 2008 13:20:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717551#M894935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-03T13:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: CONSTRUCTORS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717552#M894936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructor method&lt;/P&gt;&lt;P&gt;Implicitly, each class has an instance constructor method with the reserved name constructor and a static constructor method with the reserved name class_constructor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT statement, while the class constructor is executed exactly once before you first access a class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The constructors are always present. However, to implement a constructor you must declare it explicitly with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Static constructor&lt;/P&gt;&lt;P&gt;The static constructor is always called CLASS_CONSTRUCTER, and is called autmatically before the clas is first accessed, that is before any of the following actions are executed:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Creating an instance using CREATE_OBJECT&lt;/P&gt;&lt;P&gt;2) Adressing a static attribute using &amp;lt;classname&amp;gt;-&amp;gt;&amp;lt;attrbute&amp;gt;&lt;/P&gt;&lt;P&gt;3) Calling a ststic attribute using CALL METHOD&lt;/P&gt;&lt;P&gt;4) Registering a static event handler&lt;/P&gt;&lt;P&gt;5) Registering an evetm handler method for a static event&lt;/P&gt;&lt;P&gt;The static constructor cannot be called explicitly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check out this link for example program using constructor...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/OO/eg.htm#Use" target="test_blank"&gt;http://www.erpgenie.com/abap/OO/eg.htm#Use&lt;/A&gt; constructor to create an object with parameters&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 May 2008 13:23:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717552#M894936</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-03T13:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: CONSTRUCTORS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717553#M894937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The full form of OOPS is object oriented programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Implicitly, each class has an instance constructor method with the reserved name constructor and a static constructor method with the reserved name class_constructor. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The instance constructor is executed each time you create an object (instance) with the CREATE OBJECT statement, while the class constructor is executed exactly once before you first access a class. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The constructors are always present. However, to implement a constructor you must declare it explicitly with the METHODS or CLASS-METHODS statements. An instance constructor can have IMPORTING parameters and exceptions. You must pass all non-optional parameters when creating an object. Static constructors have no parameters. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to start from scratch go to transaction abapdocu which will help u in learning on ur own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also refer to this link.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.erpgenie.com/abap/OO/defn.htm" target="test_blank"&gt;http://www.erpgenie.com/abap/OO/defn.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;imran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 May 2008 13:24:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717553#M894937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-03T13:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: CONSTRUCTORS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717554#M894938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vijaya lakshmi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OOP is the common abbreviation for Object-Oriented Programming.  eg C++ is Object oriented programming language...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like that in SAP we are having &lt;STRONG&gt;OO ABAP&lt;/STRONG&gt; which stands for Object Oriented ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;METHODS - constructor&lt;/STRONG&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Syntax 
METHODS constructor [FINAL] 
  [IMPORTING parameters [PREFERRED PARAMETER p]] 
  [{RAISING|EXCEPTIONS} exc1 exc2 ...]. 



Extras: 
1. ... IMPORTING parameters 

2. ... RAISING exc1 exc2 ... 

3. ... EXCEPTIONS exc1 exc2 ... 

4. ... FINAL 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;: This statement declares the instance constructor constructor of the class. For public and protected instantiatable classes, this is only possible in the public visibility section of the declaration section of a class. If you use the addition CREATE PRIVATE in the CLASS DEFINITION statement, this is possible in all visibility sections. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each class has a predefined method called constructor. By declaring this explicitly, the interface of the method constructor can be defined specifically for a class, and its functions can be implemented. Without explicit declaration, the instance constructor assumes the parameter interface of the direct superclass, and calls it implicitly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the instance constructor is implemented in a subclass, the instance constructor of the superclass must be called explicitly using the pseudo reference super-&amp;gt;constructor, even if the latter is not explicitly declared. Exceptions to this are direct subclasses of the root node object. Before the superclass contructor is called, an instance constructor only has access to the static components of its class. After the superclass constructor is called, it can also access instance components. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each instance of a class, the instance constructor is called only once using the statement CREATE OBJECT immediately after it has been generated. For the call, appropriate actual parameters must be assigned to all non-optional input parameters, return values can be assigned to non-class-based exceptions, and class-based exceptions can be declared. It is not possible to call the instance constructor using CALL METHOD, except when calling the superclass constructors using super-&amp;gt;constructor in the redefined constructor of a subclass. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During execution of an instance constructor, the current instance temporarily assumes the type of the class in which the constructor is defined. This has the following consequences: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If methods are called during the execution of a superclass constructor, the implementations of the superclass are executed and not the redefinitions of subclasses. The specification of me-&amp;gt;, for addressing a redefined method in a subclass that has just been generated, has no effect. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During execution of a superclass constructor, attempts to access components of the subclass using a Down Cast lead to a runtime error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instance constructors are an exception to the rule that all public components on one path in the inheritance hierarchy are in the same namespace. The instance constructor of each class has its own interface and its own implementation. An instance constructor cannot be redefined. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instance constructors are declared in the public visibility section of a class purely for technical reasons. The actual visibility is controlled by the addition CREATE {PUBLIC|PROTECTED|PRIVATE} to the statement CLASS DEFINITION . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Addition 1 
... IMPORTING parameters 


Addition 2 
... RAISING exc1 exc2 ... 


Addition 3 
... EXCEPTIONS exc1 exc2 ... 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;: Using the IMPORTING addition, input parameters can be defined according to the same rules as for general methods. The additions RAISING and EXCEPTIONS for the declaration of class-based exceptions or the definition of non-class-based exceptions also have the same meaning as for general methods. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Addition 4 &lt;/P&gt;&lt;P&gt;... FINAL &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Effect &lt;/P&gt;&lt;P&gt;: Instance constructors are implicitly final. The addition FINAL can be specified, but it is not necessary. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: &lt;/P&gt;&lt;P&gt;In this example, the class c2 inherits from the class c1. In both classes, the instance constructor constructor is declared explicitly. It must therefore be implemented in both classes, whereby the implementation in c2 must include the call of the superclass constructor. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS c1 DEFINITION. 
  PUBLIC SECTION. 
    METHODS constructor IMPORTING p1 TYPE any. 
    ... 
ENDCLASS. 

CLASS c2 DEFINITION INHERITING FROM c1. 
  PUBLIC SECTION. 
    METHODS constructor IMPORTING p2 TYPE any. 
    ... 
ENDCLASS. 

CLASS c1 IMPLEMENTATION. 
  METHOD constructor. 
    ... 
  ENDMETHOD. 
ENDCLASS. 

CLASS c2 IMPLEMENTATION. 
  METHOD constructor. 
    ... 
    super-&amp;gt;constructor( p2 ). 
    ... 
  ENDMETHOD. 
ENDCLASS. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will solve your problem..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward points if useful...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;ilesh 24x7&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 May 2008 13:25:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717554#M894938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-03T13:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: CONSTRUCTORS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717555#M894939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi lakshmi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;oops is nothing but object oriented programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here in abap, uses the concept of OOPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we call them as &lt;STRONG&gt;ABAP Objects&lt;/STRONG&gt; or &lt;STRONG&gt;OOABAP&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructors are special methods for a class.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Instance constructor&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;static constructor&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constructors are the special methods that cannot be called using &lt;STRONG&gt;CALL METHOD&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;instead, they are called &lt;STRONG&gt;automatically by the system to set the starting state of a new object or class&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Instance constructor&lt;/STRONG&gt; : instance constructor of a class gets triggered when an object is created from the class.&lt;/P&gt;&lt;P&gt;these are Instance specific.( Object specific..if &lt;STRONG&gt;n&lt;/STRONG&gt; objects are created , n times the constructor is called ..with each of has its own memory allocated for it..)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;instance constructor have import parameters and Exceptions.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Static Constructor&lt;/STRONG&gt; : Static constructor (class Constructor) is triggered before any of the following events:&lt;/P&gt;&lt;P&gt;when Creating an Object of a class using&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;CREATE OBJECT obj_name&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;whre obj_name has the Data type REF TO class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;calling a static method using Class =&amp;gt; method.&lt;/P&gt;&lt;P&gt;we can directly call static method with its class name on left side,&lt;/P&gt;&lt;P&gt;and method name on right side.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;Class_name&amp;gt; =&amp;gt; &amp;lt;Method_name&amp;gt;&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Static constructor Cannot have any parameters.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if useful reward me.&lt;/P&gt;&lt;P&gt;if any doubts regarding this let me know...!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Rajesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 03 May 2008 13:33:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/constructors/m-p/3717555#M894939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-03T13:33:45Z</dc:date>
    </item>
  </channel>
</rss>

