<?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: How to create an class object in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125679#M1364483</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Class definition - class implementation is treated by system as declaration part. This is similary considered as DATA, TYPES section. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every single statement which is not part of declaration/definition is part of program to execute (is automatically embraced to START-OF-SELECTION event). In regular program when you set DATA, TYPES it can both occur in declaration part and in execution part. On the other hand CLASS...ENDCLASS is considered purely as declaration/definition (not executable code itself) so can't be placed in START-OF-SELECTION. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming above, when you place CREATE OBJECT b/w CLASS....DEFINITON - CLASS .... IMPLEMENTATION it is recognized as part of executable code, but is placed within the one not intended to be executed. System can't split this code to declaration/execution part. It must be explicitly pointed. So it must be of strcuture&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"------------------------- DECLARATION/DEFINITION ---------------------
CLASS lcl_retal DEFINITION.
  PUBLIC SECTION.
    METHODS constructor.
  PRIVATE SECTION.
    DATA: lv_car(10) TYPE c VALUE 'CAR',
                    lv_truck(10) TYPE c VALUE 'TRUCK'.
ENDCLASS.                    "lcl_retal DEFINITION
 
"&amp;lt;- here still part of this block, so no executable statements allowed 

CLASS lcl_retal IMPLEMENTATION.
 
  METHOD constructor .
    WRITE: lv_car, space, lv_truck.
  ENDMETHOD. "print_detaile
 
ENDCLASS.                    "lcl_retal IMPLEMENTATION

"---------------------------- EXECUTABLE CODE HERE ---------------
DATA: lo_retal TYPE REF TO lcl_retal.
CREATE OBJECT lo_retal.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope now it is clear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Sep 2009 07:35:03 GMT</pubDate>
    <dc:creator>MarcinPciak</dc:creator>
    <dc:date>2009-09-02T07:35:03Z</dc:date>
    <item>
      <title>How to create an class object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125678#M1364482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why we need set the 'Create object xx' between 'class definition' and  'class implementation'??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i set the 'CREATE OBJECT' under the 'Class implementation' in a report,  the system will tell me that: 'Statement is not accessible'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS lcl_retal DEFINITION.
  PUBLIC SECTION.
    METHODS constructor.
  PRIVATE SECTION.
    DATA: lv_car(10) TYPE c VALUE 'CAR',
                    lv_truck(10) TYPE c VALUE 'TRUCK'.
ENDCLASS.                    "lcl_retal DEFINITION

CLASS lcl_retal IMPLEMENTATION.

  METHOD constructor .
    WRITE: lv_car, space, lv_truck.
  ENDMETHOD. "print_detaile

ENDCLASS.                    "lcl_retal IMPLEMENTATION

DATA: lo_retal TYPE REF TO lcl_retal.
CREATE OBJECT lo_retal.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: YINYAN LU on Sep 2, 2009 9:14 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 07:12:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125678#M1364482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-02T07:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an class object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125679#M1364483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Class definition - class implementation is treated by system as declaration part. This is similary considered as DATA, TYPES section. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every single statement which is not part of declaration/definition is part of program to execute (is automatically embraced to START-OF-SELECTION event). In regular program when you set DATA, TYPES it can both occur in declaration part and in execution part. On the other hand CLASS...ENDCLASS is considered purely as declaration/definition (not executable code itself) so can't be placed in START-OF-SELECTION. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assuming above, when you place CREATE OBJECT b/w CLASS....DEFINITON - CLASS .... IMPLEMENTATION it is recognized as part of executable code, but is placed within the one not intended to be executed. System can't split this code to declaration/execution part. It must be explicitly pointed. So it must be of strcuture&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
"------------------------- DECLARATION/DEFINITION ---------------------
CLASS lcl_retal DEFINITION.
  PUBLIC SECTION.
    METHODS constructor.
  PRIVATE SECTION.
    DATA: lv_car(10) TYPE c VALUE 'CAR',
                    lv_truck(10) TYPE c VALUE 'TRUCK'.
ENDCLASS.                    "lcl_retal DEFINITION
 
"&amp;lt;- here still part of this block, so no executable statements allowed 

CLASS lcl_retal IMPLEMENTATION.
 
  METHOD constructor .
    WRITE: lv_car, space, lv_truck.
  ENDMETHOD. "print_detaile
 
ENDCLASS.                    "lcl_retal IMPLEMENTATION

"---------------------------- EXECUTABLE CODE HERE ---------------
DATA: lo_retal TYPE REF TO lcl_retal.
CREATE OBJECT lo_retal.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope now it is clear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 07:35:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125679#M1364483</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-09-02T07:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an class object</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125680#M1364484</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;Thanks for your help. This is very useful for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Best regards,&lt;/P&gt;&lt;P&gt;Yinyan Lu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Sep 2009 07:58:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-an-class-object/m-p/6125680#M1364484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-02T07:58:20Z</dc:date>
    </item>
  </channel>
</rss>

