<?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 Objects: Private variable with reference to global internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075908#M96265</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been messing with your example code for a while now, trying to use field symbols, but even then the field symbol must be global.  You may be able to pass the table to a method like you do when filling it, and refresh inside the method.&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 Dec 2005 17:39:31 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-12-09T17:39:31Z</dc:date>
    <item>
      <title>ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075903#M96260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello. I want an object that can hold a private reference&lt;/P&gt;&lt;P&gt;to a global internal table so that when one of it's methods are invoked, the global table contents are modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simplification of scenario:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
class myObject definition.
*
  public section.
*
    methods: 
      set_global_table
        importing reference(i_table) type standard table,
*
      change_global_table.
*
  private section.
*
    data:
      m_pointer_to_table " not sure how to type this"
*
endclass.
*
class myObject implementation.
*
  method set_global_table.
*
    m_pointer_to_table = i_table. " this needs to  "
                                  " assign a pointer to "
                                  " the global variable "
*
  endmethod.
*
*
  method change_global_table.
*
    refresh m_pointer_to_table. "this should change "
                                "the contents of global "
                                "variable "
  endmethod.
*
endclass.
*
*
data: gt_itable   type standard table of t_widget,
      go_myobject type ref to myobject.
*
* Main code
*
  create object go_myobject.
*
*
*
* phantom code fills gt_itable
*
*
  call method go_myobject-&amp;gt;set_global_table
                exporting i_table = gt_itable.
*
  call method go_myobject-&amp;gt;change_global_table.
*
*
  if gt_itable is initial.
*
     write 'this should output'.
*
  endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code here doesn't work and I've tried messing with field-symbols, etc. all to no avail. Thank you for any help you could provide!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brett&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 16:01:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075903#M96260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T16:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075904#M96261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;One small question. Is this pointer to global table always pointing to same internal table or differnt tables depending on the situation in runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 16:07:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075904#M96261</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T16:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075905#M96262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There's a global table that stores the data for an ALV grid control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an object that holds the event handler for a tree control. When a person double clicks on a node, I want to query a db and reset the grid data within the event handler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since there's no way to pass in the global table on the event handler method, the object I've defined needs to have a reference to it already in the form of a class/private variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps clarify!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brett&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 16:23:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075905#M96262</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T16:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075906#M96263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure that I completely understand what you are trying to do, but in your event handler method, can you call a subroutine(FORM) that would refresh your grid data?&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 Dec 2005 17:23:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075906#M96263</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-09T17:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075907#M96264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's definitely an option. I was just hoping to find a way within the OO context.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to settle with your suggestion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brett&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 17:34:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075907#M96264</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T17:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075908#M96265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been messing with your example code for a while now, trying to use field symbols, but even then the field symbol must be global.  You may be able to pass the table to a method like you do when filling it, and refresh inside the method.&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 Dec 2005 17:39:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075908#M96265</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-09T17:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Objects: Private variable with reference to global internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075909#M96266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just typed in this editor - so no syntax-check but you will get the idea: &lt;/P&gt;&lt;P&gt;Pass the internal table and get the reference of it&lt;/P&gt;&lt;P&gt;Store the reference and manipulate the global contents with local field-symbols to which you have assigned the reference. &lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&amp;gt; class myObject definition.
&amp;gt; *
&amp;gt;   public section.
&amp;gt; *
&amp;gt;     methods: 
&amp;gt;       set_global_table
&amp;gt; importing reference(i_table) type standard
&amp;gt; standard table,
&amp;gt; *
&amp;gt;       change_global_table.
&amp;gt; *
&amp;gt;   private section.
&amp;gt; *
&amp;gt;     data:
&amp;gt; m_pointer_to_table type ref to data
&amp;gt; *
&amp;gt; endclass.
&amp;gt; *
&amp;gt; class myObject implementation.
&amp;gt; *
&amp;gt;   method set_global_table.
&amp;gt; *
     GET REFERENCE of i_table into m_pointer_to_table.
&amp;gt;   endmethod.
&amp;gt; *
&amp;gt; *
&amp;gt;   method change_global_table.
&amp;gt; *
  field-symbols: &amp;lt;lit_table&amp;gt; type any table. 
    assign m_pointer_to_table to &amp;lt;lit_table&amp;gt;.
 * manipulate &amp;lt;lit_table&amp;gt;

&amp;gt;   endmethod.
&amp;gt; *
&amp;gt; endclass.
&amp;gt; *
&amp;gt; *
&amp;gt; data: gt_itable   type standard table of t_widget,
&amp;gt;       go_myobject type ref to myobject.
&amp;gt; *
&amp;gt; * Main code
&amp;gt; *
&amp;gt;   create object go_myobject.
&amp;gt; *
&amp;gt; *
&amp;gt; *
&amp;gt; * phantom code fills gt_itable
&amp;gt; *
&amp;gt; *
&amp;gt;   call method go_myobject-&amp;gt;set_global_table
&amp;gt;                 exporting i_table = gt_itable.
&amp;gt; *
&amp;gt;   call method go_myobject-&amp;gt;change_global_table.
&amp;gt; *
&amp;gt; *
&amp;gt;   if gt_itable is initial.
&amp;gt; *
&amp;gt;      write 'this should output'.
&amp;gt; *
&amp;gt;   endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; The code here doesn't work and I've tried messing&lt;/P&gt;&lt;P&gt;&amp;gt; with field-symbols, etc. all to no avail. Thank you&lt;/P&gt;&lt;P&gt;&amp;gt; for any help you could provide!&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Brett&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2005 21:56:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-objects-private-variable-with-reference-to-global-internal-table/m-p/1075909#M96266</guid>
      <dc:creator>ChristianFi</dc:creator>
      <dc:date>2005-12-10T21:56:33Z</dc:date>
    </item>
  </channel>
</rss>

