<?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: Free object problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294148#M500751</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick and right answer!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 May 2007 14:09:51 GMT</pubDate>
    <dc:creator>david_fryda2</dc:creator>
    <dc:date>2007-05-24T14:09:51Z</dc:date>
    <item>
      <title>Free object problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294145#M500748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a code where the object is not really cleared.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLASS testfree DEFINITION.
  PUBLIC SECTION.
    METHODS set_var.
    METHODS getvar EXPORTING pv_text TYPE char10.
  PRIVATE SECTION.
    CLASS-DATA : gv_text(10).
ENDCLASS.        

CLASS testfree IMPLEMENTATION.
  METHOD set_var.
    gv_text = 'hello world'.
  ENDMETHOD.                    "set_var
  METHOD getvar.
    pv_text =  gv_text.
  ENDMETHOD.                    "getvar

ENDCLASS.                    "testfree IMPLEMENTATION

START-OF-SELECTION.
  DATA: go_testfree TYPE REF TO testfree,
        gv_text1(10).
  CREATE OBJECT go_testfree.
  CALL METHOD go_testfree-&amp;gt;set_var.
  CALL METHOD go_testfree-&amp;gt;getvar
    IMPORTING
      pv_text = gv_text1.
  WRITE:/ 'before free : ', gv_text1.

  FREE  go_testfree .
  CLEAR gv_text1.

  CREATE OBJECT go_testfree.
  CALL METHOD go_testfree-&amp;gt;getvar
    IMPORTING
      pv_text = gv_text1.
  WRITE:/ 'After free : ', gv_text1.


The problem is that gv_text1 is still set to value 'hello world' after the FREE command.
How is it possible ?

Thanks
Regards.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 13:58:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294145#M500748</guid>
      <dc:creator>david_fryda2</dc:creator>
      <dc:date>2007-05-24T13:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Free object problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294146#M500749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I guess declaring it as CLASS-DATA is the problem here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;declare that as DATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : gv_text(10).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 14:07:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294146#M500749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-24T14:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Free object problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294147#M500750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason is simply,  you have declare the GV_TEXT attribute as a static attribute.  You did this using the CLASS-DATA statement, if you want it to be an instance attribute,  you need to define with a DATA statement instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  private section.
     data: gv_text(10).&lt;/CODE&gt;&lt;/PRE&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>Thu, 24 May 2007 14:09:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294147#M500750</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-05-24T14:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Free object problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294148#M500751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick and right answer!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2007 14:09:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/free-object-problem/m-p/2294148#M500751</guid>
      <dc:creator>david_fryda2</dc:creator>
      <dc:date>2007-05-24T14:09:51Z</dc:date>
    </item>
  </channel>
</rss>

