<?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: Getting the objects for a class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207748#M472570</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Johan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method cl_gui_cfw=&amp;gt;get_living_dynpro_controls return the living control instance in a table type CNTO_CONTROL_LIST (TYPE REF TO CL_GUI_CONTROL OCCURS 0, type-pool CNTO).&lt;/P&gt;&lt;P&gt;Thus, simply loop over the itab because CL_GUI_CONTROL is the superclass of all other GUI controls:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  lo_control    TYPE REF TO cl_gui_control,
  lt_controls   TYPE cnto_control_list.

" lt_controls contains the living control instances

  LOOP AT lt_controls INTO lo_control.
    lo_control-&amp;gt;free( ).
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 May 2007 12:17:22 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2007-05-09T12:17:22Z</dc:date>
    <item>
      <title>Getting the objects for a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207747#M472569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am able to get all live classes of a dynpro by using method cl_gui_cfw=&amp;gt;get_living_dynpro_controls. (Also thanks to this forum).&lt;/P&gt;&lt;P&gt;The resulting table has a reference to a class like ...&lt;/P&gt;&lt;P&gt;&lt;SPAN __jive_macro_name="O"&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;How do I use this reference to:&lt;/P&gt;&lt;P&gt;1. Get the objects for it? &lt;/P&gt;&lt;P&gt;2. How can I then free the object from memory by using the "free" method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I am asking how to dynamically assign it, then make sure it has a free method and then to use the method to actually free it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2007 12:04:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207747#M472569</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-09T12:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the objects for a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207748#M472570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Johan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Method cl_gui_cfw=&amp;gt;get_living_dynpro_controls return the living control instance in a table type CNTO_CONTROL_LIST (TYPE REF TO CL_GUI_CONTROL OCCURS 0, type-pool CNTO).&lt;/P&gt;&lt;P&gt;Thus, simply loop over the itab because CL_GUI_CONTROL is the superclass of all other GUI controls:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
  lo_control    TYPE REF TO cl_gui_control,
  lt_controls   TYPE cnto_control_list.

" lt_controls contains the living control instances

  LOOP AT lt_controls INTO lo_control.
    lo_control-&amp;gt;free( ).
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2007 12:17:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207748#M472570</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-05-09T12:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the objects for a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207749#M472571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Uwe&lt;/P&gt;&lt;P&gt;My first reaction was "NO it cannot be that easy!!". It almost was but on the second line I get a short dump. Then I realised why: the other live control in the table was a sub class of the first class and as a result it was cleared on the first call.&lt;/P&gt;&lt;P&gt;So I modified the call to be a recursive call (of the form) as follows...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;form clear_live_controls .
DATA:
  gt_list       TYPE cnto_control_list,
  gt_wa like line of gt_list.

  REFRESH: gt_list.
  CALL METHOD cl_gui_cfw=&amp;gt;get_living_dynpro_controls
    IMPORTING
      control_list = gt_list.
  describe table gt_list lines tab_lines.
  if tab_lines = 0.
*    Nothing
  else.
     loop at gt_list into gt_wa.
       gt_wa-&amp;gt;free( ).
       exit.
     endloop.
     perform clear_live_controls.
  endif.
endform.                    " clear_live_controls&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This took care of it. &lt;/P&gt;&lt;P&gt;Many thanks for your help.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2007 12:47:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/getting-the-objects-for-a-class/m-p/2207749#M472571</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-09T12:47:05Z</dc:date>
    </item>
  </channel>
</rss>

