<?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: Destructor for Class CL_COLUMN_TREE_MODEL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750731#M1114268</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi Thomas,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; the variable, which I want to destroy, is defined with reference to CL_COLUMN_TREE_MODEL.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; I want to destroy it: FREE OBJECT gw_tree, but I get a syntax error: variables with references cann't be destroyed with FREE.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Do You know perhaps another solution ?&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards  Peter&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you are wanting to do is destroy the object &lt;STRONG&gt;refered&lt;/STRONG&gt; to by the object reference variable - not the object reference variable itself.  When an object on the heap no longer has any object reference variables assigned to it, then it will be collected (at some undefined time) by the garbage collector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CREATE gw_tree.
* do stuff
CLEAR gw_tree&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; will mean no more references to the object created by the CREATE, so the memory the object is using will be reclaimed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Oct 2008 15:14:05 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2008-10-31T15:14:05Z</dc:date>
    <item>
      <title>Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750725#M1114262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Colleagues !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In an FM I build a tree for the class CL_COLUMN_TREE_MODEL. It works fine. But this class doesn't have a destructor method for the tree (I want to use it at exit from the FM). Do You know a solution for it ? Is there an FM for destroying the address room after calling this FM (it would be a solution too - if I call this FM more times in the same program).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for Your help and kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moved by moderator to correct forum&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 11:41:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750725#M1114262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T11:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750726#M1114263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ABAP does not know the concept of destructors, instead it has the garbage collector, which destroys any object which is no longer referenced. Thus all you have to do is:&lt;/P&gt;&lt;P&gt;1.) call the control framework method "free"; clear the object reference variable of your cl_gui_column_tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 13:38:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750726#M1114263</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T13:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750727#M1114264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the variable, which I want to destroy, is defined with reference to CL_COLUMN_TREE_MODEL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to destroy it: FREE OBJECT gw_tree, but I get a syntax error: variables with references cann't be destroyed with FREE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do You know perhaps another solution ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards  Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 13:56:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750727#M1114264</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T13:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750728#M1114265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simply do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lo_column_tree-&amp;gt;free( ). &lt;/P&gt;&lt;P&gt;clear lo_column_tree. &lt;/P&gt;&lt;P&gt;lo_column_tree_container-&amp;gt;free( ). &lt;/P&gt;&lt;P&gt;clear lo_column_tree_container.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "free" frees the GUI control on the SAP GUI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 13:58:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750728#M1114265</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T13:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750729#M1114266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I make the followings:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class lcl_tree definition inheriting from CL_COLUMN_TREE_MODEL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:       G_TREE TYPE REF TO lcl_TREE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   CREATE OBJECT G_TREE&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;     ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These codes are OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At exit I want make:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE exit INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   CALL METHOD g_tree-&amp;gt;free().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   clear: g_tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   leave to screen 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMODULE.                 " exit  INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I get the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Die Methode "FREE()" ist unbekannt bzw. PROTECTED oder PRIVATE."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I make anything false ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do You have an idea ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 14:49:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750729#M1114266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T14:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750730#M1114267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First try to free the Tree object and than free the Container object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data  o_tree         type ref to cl_column_tree_model.
data  o_container       type ref to cl_gui_custom_container.

MODULE EXIT.
  if not o_tree is initial.
    clear o_tree.
    free o_tree.
  endif.
  if not o_container is initial.
    call method o_container-&amp;gt;free.
    free o_container.
  endif.

ENDMODULE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 15:05:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750730#M1114267</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2008-10-31T15:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750731#M1114268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi Thomas,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; the variable, which I want to destroy, is defined with reference to CL_COLUMN_TREE_MODEL.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; I want to destroy it: FREE OBJECT gw_tree, but I get a syntax error: variables with references cann't be destroyed with FREE.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Do You know perhaps another solution ?&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards  Peter&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you are wanting to do is destroy the object &lt;STRONG&gt;refered&lt;/STRONG&gt; to by the object reference variable - not the object reference variable itself.  When an object on the heap no longer has any object reference variables assigned to it, then it will be collected (at some undefined time) by the garbage collector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CREATE gw_tree.
* do stuff
CLEAR gw_tree&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; will mean no more references to the object created by the CREATE, so the memory the object is using will be reclaimed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 15:14:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750731#M1114268</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-10-31T15:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750732#M1114269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your column tree model you somewhere create a tree control and a container for that control, i.e. you call the method "create_tree_control" and you are exporting the container for the control and you get back an object of type cl_gui_control. On this object you call the "free" method. After you freed the control you have to free also the container. The model itself is cleared by clead lo_tree_model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 15:34:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750732#M1114269</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T15:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Destructor for Class CL_COLUMN_TREE_MODEL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750733#M1114270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Naimesh Patel, hi Thomas !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You for helping ! I took the proposal of Naimesh Patel (it comes earlier), and it works fine !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will open another thread in this forum, please check it too !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot and kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Oct 2008 15:57:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/destructor-for-class-cl-column-tree-model/m-p/4750733#M1114270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-31T15:57:35Z</dc:date>
    </item>
  </channel>
</rss>

