<?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: abap object in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943817#M389293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you may be a little confused about constructor.  You can think of a constructor, as a initialization method.  Meaning, that when you say CREATE OBJECT,  the CONSTRUCTOR is the first method which is fired by the CREATE OBJECT statement.  You do not need a CONSTRUCTOR in order to create an instance(object) of a class.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, this program has no CONSTRUCTOR, there for it only creates a instance of the class, nothing more, nothing less.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.


*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    DATA: value TYPE i.
    METHODS: set_value IMPORTING im_value TYPE i.
ENDCLASS.                    "lcl_app DEFINITION

DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

CREATE OBJECT o_app1.
o_app1-&amp;gt;set_value( 10 ).
write:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2.
o_app2-&amp;gt;set_value( 20 ).
write:/ o_app2-&amp;gt;value.

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.
  METHOD set_value.
    value = im_value.
  ENDMETHOD.                    "set_value
ENDCLASS.                    "lcl_app IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that I have a method called SET_VALUE.  This method will set the value of the instance of the object which was created by the CREATE OBJECT statement.  You could fill the VALUE directly with the CREAT OBJECT statement, this will fire the CONSTRUCTOR and fill the value.  So we have to modify the class a bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.


*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    DATA: value TYPE i.
    METHODS: constructor IMPORTING im_value TYPE i.
ENDCLASS.                    "lcl_app DEFINITION

DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

CREATE OBJECT o_app1
      EXPORTING im_value = 10.
WRITE:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2
      EXPORTING im_value = 20.
WRITE:/ o_app2-&amp;gt;value.

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.
  METHOD CONSTRUCTOR.
    value = im_value.
  ENDMETHOD.                    "set_value
ENDCLASS.                    "lcl_app IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly, the "." period is a separator between the class or object and the method name.  The period is used in the java language as well as others.  In ABAP the separator is -&amp;gt; for instance methods and attributes, and =&amp;gt; for static methods and attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Feb 2007 00:28:08 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2007-02-09T00:28:08Z</dc:date>
    <item>
      <title>abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943816#M389292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;may i know the following from gurus. thanks in advance.&lt;/P&gt;&lt;P&gt;1) may i know if in the class has no constructor method then it is something like function already? i was told constructor is just declaration and not peculiar to object. but to me, if no constructor, then the private/public/protected variable for instance will only have initial value. if that is so, then to me, its like function and not much difference besides object is multiple instance whereas function only 1 instance. also if all instance have initial value for its private/public/protected variable, then all instances are the same. &lt;/P&gt;&lt;P&gt;for example, if class has constructor and i have 2 instances of the class, my first instance has variable count with value 10 then my second instance has value 30. from here we can see the difference between instance or object.&lt;/P&gt;&lt;P&gt;i thought that is the beauty of abap object as value also wrapped in the instance(object).&lt;/P&gt;&lt;P&gt;2) may i know if constructor important to abap object?&lt;/P&gt;&lt;P&gt;3) somebody told me that the beauty of oo is the "." &lt;/P&gt;&lt;P&gt;but i don't know how abap is using the "."  like below example. can have the advice?&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;customer.new()&lt;/P&gt;&lt;P&gt;customer.setNo()&lt;/P&gt;&lt;P&gt;customer.setName()&lt;/P&gt;&lt;P&gt;customer.save()&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 23:57:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943816#M389292</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T23:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943817#M389293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you may be a little confused about constructor.  You can think of a constructor, as a initialization method.  Meaning, that when you say CREATE OBJECT,  the CONSTRUCTOR is the first method which is fired by the CREATE OBJECT statement.  You do not need a CONSTRUCTOR in order to create an instance(object) of a class.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, this program has no CONSTRUCTOR, there for it only creates a instance of the class, nothing more, nothing less.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.


*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    DATA: value TYPE i.
    METHODS: set_value IMPORTING im_value TYPE i.
ENDCLASS.                    "lcl_app DEFINITION

DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

CREATE OBJECT o_app1.
o_app1-&amp;gt;set_value( 10 ).
write:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2.
o_app2-&amp;gt;set_value( 20 ).
write:/ o_app2-&amp;gt;value.

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.
  METHOD set_value.
    value = im_value.
  ENDMETHOD.                    "set_value
ENDCLASS.                    "lcl_app IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice that I have a method called SET_VALUE.  This method will set the value of the instance of the object which was created by the CREATE OBJECT statement.  You could fill the VALUE directly with the CREAT OBJECT statement, this will fire the CONSTRUCTOR and fill the value.  So we have to modify the class a bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.


*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    DATA: value TYPE i.
    METHODS: constructor IMPORTING im_value TYPE i.
ENDCLASS.                    "lcl_app DEFINITION

DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

CREATE OBJECT o_app1
      EXPORTING im_value = 10.
WRITE:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2
      EXPORTING im_value = 20.
WRITE:/ o_app2-&amp;gt;value.

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.
  METHOD CONSTRUCTOR.
    value = im_value.
  ENDMETHOD.                    "set_value
ENDCLASS.                    "lcl_app IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lastly, the "." period is a separator between the class or object and the method name.  The period is used in the java language as well as others.  In ABAP the separator is -&amp;gt; for instance methods and attributes, and =&amp;gt; for static methods and attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 00:28:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943817#M389293</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-09T00:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943818#M389294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check this example:&lt;/P&gt;&lt;P&gt;REPORT  YSUBDEL LINE-SIZE 120.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CLASS c1 DEFINITION .&lt;/P&gt;&lt;P&gt; PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;  DATA : commondata(30) type c value 'Accessible to all'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CLASS c1 IMPLEMENTATION.&lt;/P&gt;&lt;P&gt; endclass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;   DATA : obj1 type ref to c1.&lt;/P&gt;&lt;P&gt;   create object : obj1.&lt;/P&gt;&lt;P&gt;   write:/5 obj1-&amp;gt;commondata.&lt;/P&gt;&lt;P&gt;               &lt;/P&gt;&lt;P&gt;In abap,we can use '.' function by -&amp;gt;.&lt;/P&gt;&lt;P&gt;obj1 is the instance of the class and we can access the methods of the class&lt;/P&gt;&lt;P&gt;using obj1-&amp;gt;meth1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u,&lt;/P&gt;&lt;P&gt;keerthi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 01:00:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943818#M389294</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T01:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943819#M389295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rich,&lt;/P&gt;&lt;P&gt;i tested and found out &lt;/P&gt;&lt;P&gt;1) if create object with exporting addition, it looks for constructor method. may i know why?&lt;/P&gt;&lt;P&gt;CREATE OBJECT o_app1&lt;/P&gt;&lt;P&gt;      EXPORTING im_value = 10.&lt;/P&gt;&lt;P&gt;2) why the sample with constructor shows nothing even has write?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 02:26:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943819#M389295</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T02:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943820#M389296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If a CONSTRUCTOR method exists for the class, it will be fired when CREATE OBJECT is executed regardless if the CONSTRUCTOR has a signature(exporting, importing parameters)  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Not sure what you mean, as that example works fine in my system, it simply outputs the values 10 and 20.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 02:34:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943820#M389296</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-09T02:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943821#M389297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rich,&lt;/P&gt;&lt;P&gt;1) when i change the method name to other than constructor, i will get the following when compile if have the exporting addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For "LCL_APP", no CONSTRUCTOR has been defined.		&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) your first example can show the output. just need to add the call method as your sample missing. but second example not showing anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 02:51:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943821#M389297</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T02:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943822#M389298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) That's right,  if you have parameters in the CREATE OBJECT statement, then you must have a constructor, but if there are no parameters, and there is a CONTRUCTOR, it will be fired at CREATE OBJECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.


*----------------------------------------------------------------------*
*       CLASS lcl_app DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    DATA: value TYPE i.
    METHODS: constructor."  IMPORTING im_value TYPE i.
ENDCLASS.                    "lcl_app DEFINITION

DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

CREATE OBJECT o_app1. " EXPORTING im_value = 10.
WRITE:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2. " EXPORTING im_value = 20.
WRITE:/ o_app2-&amp;gt;value.

*----------------------------------------------------------------------*
*       CLASS lcl_app IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_app IMPLEMENTATION.
  METHOD CONSTRUCTOR.
    value = 10.  "im_value.
  ENDMETHOD.                    "set_value
ENDCLASS.                    "lcl_app IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Again, my 2nd example is working well for me.  If you post the code that you implemented,  I can see what may be the problem.  The reason why you must add the CALL METHOD, is because you are using an older version.  You can omit the CALL METHOD in Netweaver releases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 03:09:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943822#M389298</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-09T03:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943823#M389299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi rich, you have cleared my doubt. thanks&lt;/P&gt;&lt;P&gt;this is the 2nd example that not showing the write statement. it executed but immediately after the execution the screen shows the se80 screen back.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT zrich_0001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_app DEFINITION.&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;    DATA: value TYPE i.&lt;/P&gt;&lt;P&gt;    METHODS: constructor IMPORTING im_value TYPE i.&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_app DEFINITION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_app IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;  METHOD CONStructor.&lt;/P&gt;&lt;P&gt;    value = im_value.&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "set_value&lt;/P&gt;&lt;P&gt;ENDCLASS.                    "lcl_app IMPLEMENTATION&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: o_app1 TYPE REF TO lcl_app.&lt;/P&gt;&lt;P&gt;DATA: o_app2 TYPE REF TO lcl_app.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT o_app1&lt;/P&gt;&lt;P&gt;      EXPORTING im_value = 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE:/ o_app1-&amp;gt;value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT o_app2&lt;/P&gt;&lt;P&gt;      EXPORTING im_value = 20.&lt;/P&gt;&lt;P&gt;WRITE:/ o_app2-&amp;gt;value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 03:20:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943823#M389299</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T03:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943824#M389300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason is that since you do not have a START-OF-SELECTION event, hence the IMPLEMENTATION must be at the end of the program.  You can either add this START-OF-SELECTION event. Like so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.

CLASS lcl_app DEFINITION.
PUBLIC SECTION.
DATA: value TYPE i.
METHODS: constructor IMPORTING im_value TYPE i.
ENDCLASS. "lcl_app DEFINITION

CLASS lcl_app IMPLEMENTATION.
METHOD CONStructor.
value = im_value.
ENDMETHOD. "set_value
ENDCLASS. "lcl_app IMPLEMENTATION

DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

start-of-selection.

CREATE OBJECT o_app1
EXPORTING im_value = 10.

WRITE:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2
EXPORTING im_value = 20.
WRITE:/ o_app2-&amp;gt;value. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or simply move the IMPLEMENTATION to the bottom of the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT zrich_0001.

CLASS lcl_app DEFINITION.
PUBLIC SECTION.
DATA: value TYPE i.
METHODS: constructor IMPORTING im_value TYPE i.
ENDCLASS. "lcl_app DEFINITION



DATA: o_app1 TYPE REF TO lcl_app.
DATA: o_app2 TYPE REF TO lcl_app.

CREATE OBJECT o_app1
EXPORTING im_value = 10.

WRITE:/ o_app1-&amp;gt;value.

CREATE OBJECT o_app2
EXPORTING im_value = 20.
WRITE:/ o_app2-&amp;gt;value. 

CLASS lcl_app IMPLEMENTATION.
METHOD CONStructor.
value = im_value.
ENDMETHOD. "set_value
ENDCLASS. "lcl_app IMPLEMENTATION

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't ask why the system is so picky, it just is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;RIch Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 03:36:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943824#M389300</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-02-09T03:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: abap object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943825#M389301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks alot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Feb 2007 03:48:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-object/m-p/1943825#M389301</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-09T03:48:57Z</dc:date>
    </item>
  </channel>
</rss>

