<?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: Class parameters not seen in all methods in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123977#M445603</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys, &lt;/P&gt;&lt;P&gt;I can't express how much you helped me.&lt;/P&gt;&lt;P&gt;I am new to ABAP though with the years with other programming languages experience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 2 lines below were the key to resolve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;me-&amp;gt;textedit = textedit.  " save the imported instance to instance
                           "attribute
  me-&amp;gt;tree      = tree.       "  dito&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Apr 2007 14:50:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-17T14:50:02Z</dc:date>
    <item>
      <title>Class parameters not seen in all methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123973#M445599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear experts,&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two classes in my program:&lt;/P&gt;&lt;P&gt;Class "screen_init" and class "screen_handler".&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Each class has its own constructor plus other methods.&lt;/P&gt;&lt;P&gt;For example class  "screen_handler" has methods "constructor", "handle_node_double_click", &lt;/P&gt;&lt;P&gt;"handle_picture_double_click", "handle_textedit_double_click".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Constructor of class "screen_init" I do:&lt;/P&gt;&lt;P&gt;- define event_handler:&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; Data  event_handler type ref to screen_handler&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;- create an object event_handler:  &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;        Create object  event_handler
           exporting textedit = textedit
                      tree = tree.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In definition section of class "screen_handler" I define constructor as:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;   methods: constructor importing
                  textedit type ref to cl_gui_textedit
                  tree type ref to cl_gui_simple_tree.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When the program creates an object  event_handler - then the Constructor of  class "screen_handler" is run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that textedit and tree are successfully received in the Constructor of "screen_handler" class. But when it gets to any other method of "screen_handler" class ( method "handle_textedit_double_click", for example) - these objects are empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need tree object when method "handle_textedit_double_click" is run - so I could read textedit and then  repopulate the tree depending on textedit value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that textedit and tree are defined in both classes in Public section:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;class screen_init definition.
public section.
    data: textedit type ref to CL_GUI_TEXTEDIT,
            tree type ref to cl_gui_simple_tree.
class screen_handler definition.
  public section.
 data: textedit type ref to CL_GUI_TEXTEDIT,
          tree type ref to cl_gui_simple_tree&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Tatyana.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 15:40:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123973#M445599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T15:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Class parameters not seen in all methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123974#M445600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Tatyana&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only possible reason I see is that you do no save the imported instance into the public instance attributes. Presumably the coding of your CONSTRUTOR method is missing the following coding:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Recommendation: rename your instance attribute, e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;class screen_init definition.
public section.
    data: mo_textedit type ref to CL_GUI_TEXTEDIT,
            mo_tree type ref to cl_gui_simple_tree.
class screen_handler definition.
  public section.
 data: mo_textedit type ref to CL_GUI_TEXTEDIT,
          mo_tree type ref to cl_gui_simple_tree  

"       Create event handler instance
        Create object  event_handler
           exporting textedit = textedit  " instance IS BOUND
                      tree = tree.               " instance IS BOUND

" Here we are inside the CONSTRUCTOR
method CONSTRUCTOR.

  me-&amp;gt;mo_textedit = textedit.  " save the imported instance to instance attribute
  me-&amp;gt;mo_tree      = tree.       "  dito

endmethod.&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>Mon, 16 Apr 2007 20:28:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123974#M445600</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-04-16T20:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Class parameters not seen in all methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123975#M445601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Uwe.&lt;/P&gt;&lt;P&gt;Just a small clarification. I think the attributes need to be decalred either as private or protected attribiutes else the concept of having a OOP program is not very much justified.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Kareem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2007 23:21:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123975#M445601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-16T23:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Class parameters not seen in all methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123976#M445602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... and I agree with Kareem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, even SAP standard classes have often public instance attributes (e.g. CL_REBD_BUILDING-&amp;gt;ms_detail) but then they are defined as &amp;lt;b&amp;gt;read-only&amp;lt;/b&amp;gt;.&lt;/P&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>Tue, 17 Apr 2007 06:23:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123976#M445602</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-04-17T06:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Class parameters not seen in all methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123977#M445603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys, &lt;/P&gt;&lt;P&gt;I can't express how much you helped me.&lt;/P&gt;&lt;P&gt;I am new to ABAP though with the years with other programming languages experience. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 2 lines below were the key to resolve the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;me-&amp;gt;textedit = textedit.  " save the imported instance to instance
                           "attribute
  me-&amp;gt;tree      = tree.       "  dito&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2007 14:50:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/class-parameters-not-seen-in-all-methods/m-p/2123977#M445603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-17T14:50:02Z</dc:date>
    </item>
  </channel>
</rss>

