<?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: Example of Self Reference in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432381#M1246392</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mohit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;me&lt;/STRONG&gt; is used to self reference the attributes and methods of a class within that class.In your program,&lt;/P&gt;&lt;P&gt;within client class implementation, you can use me-&amp;gt;name and me-&amp;gt;create_server to call the name variable and create_server method in the same class if required.Here &lt;STRONG&gt;me&lt;/STRONG&gt; represents "&lt;STRONG&gt;client class&lt;/STRONG&gt;".Similarly ,in Server class, you can use me-&amp;gt;name and me-&amp;gt;acknowledge to call the name variable and acknowledge method in the same class if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your program ,&lt;/P&gt;&lt;P&gt;CALL METHOD server_ref-&amp;gt;acknowledge&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;creator = me.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is not correct.me is not used as variable . Its only a reference variable.it shoud used me-&amp;gt;class attribute(name)/method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope , you could understand the above explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by&lt;/P&gt;&lt;P&gt;Prasad GVK.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Apr 2009 06:56:02 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-04-08T06:56:02Z</dc:date>
    <item>
      <title>Example of Self Reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432379#M1246390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am totally new to ABAP Objects and was going through a book for the same to learn the concepts.&lt;/P&gt;&lt;P&gt;There is a section of Self Reference in this book. I could not understand this concept by myself. Could you please help me out to explain this thing.&lt;/P&gt;&lt;P&gt;PFB the code that is given in this book to explain Self Reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  z_self_reference.

*----------------------------------------------------------------------*
*       CLASS client DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS client DEFINITION.
  PUBLIC SECTION.
    DATA name(10) TYPE c VALUE 'Master' READ-ONLY.
    METHODS create_server.
ENDCLASS.                    "client DEFINITION

*----------------------------------------------------------------------*
*       CLASS server DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS server DEFINITION.
  PUBLIC SECTION.
    METHODS acknowledge
     IMPORTING creator TYPE REF TO client.
  PRIVATE SECTION.
    DATA name(10) TYPE c VALUE 'Servant'.
ENDCLASS.                    "server DEFINITION

*----------------------------------------------------------------------*
*       CLASS client IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS client IMPLEMENTATION.
  METHOD create_server.
    DATA server_ref TYPE REF TO server.
    CREATE OBJECT server_ref.
    CALL METHOD server_ref-&amp;gt;acknowledge
      EXPORTING
        creator = me.
  ENDMETHOD.                    "create_server
ENDCLASS.                    "client IMPLEMENTATION

*----------------------------------------------------------------------*
*       CLASS server IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS server IMPLEMENTATION.
  METHOD acknowledge.
    DATA name TYPE string.
    name = creator-&amp;gt;name.
    WRITE: me-&amp;gt;name, 'create by', name.
  ENDMETHOD.                    "acknowledge
ENDCLASS.                    "server IMPLEMENTATION

DATA client_ref TYPE REF TO client.

START-OF-SELECTION.
  CREATE OBJECT client_ref.
  CALL METHOD client_ref-&amp;gt;create_server.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Mohit Goel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Apr 8, 2009 10:50 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 03:44:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432379#M1246390</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-08T03:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Example of Self Reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432380#M1246391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mohit,&lt;/P&gt;&lt;P&gt;Here "me-&amp;gt;name" is the self reference.&lt;/P&gt;&lt;P&gt;When a class refereing itself (i.e. Here Server class has its name) it can be named as self reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To understand, you can use "My name is Mohit". In OOPs we use "me" for "My" or "mine".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"me" should be used inside the class only to refer its own attributes or methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will be useful !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 03:55:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432380#M1246391</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-08T03:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Example of Self Reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432381#M1246392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mohit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;me&lt;/STRONG&gt; is used to self reference the attributes and methods of a class within that class.In your program,&lt;/P&gt;&lt;P&gt;within client class implementation, you can use me-&amp;gt;name and me-&amp;gt;create_server to call the name variable and create_server method in the same class if required.Here &lt;STRONG&gt;me&lt;/STRONG&gt; represents "&lt;STRONG&gt;client class&lt;/STRONG&gt;".Similarly ,in Server class, you can use me-&amp;gt;name and me-&amp;gt;acknowledge to call the name variable and acknowledge method in the same class if required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your program ,&lt;/P&gt;&lt;P&gt;CALL METHOD server_ref-&amp;gt;acknowledge&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;creator = me.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is not correct.me is not used as variable . Its only a reference variable.it shoud used me-&amp;gt;class attribute(name)/method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope , you could understand the above explanation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by&lt;/P&gt;&lt;P&gt;Prasad GVK.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 06:56:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432381#M1246392</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-04-08T06:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Example of Self Reference</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432382#M1246393</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; In your program ,&lt;/P&gt;&lt;P&gt;&amp;gt; CALL METHOD server_ref-&amp;gt;acknowledge&lt;/P&gt;&lt;P&gt;&amp;gt; EXPORTING&lt;/P&gt;&lt;P&gt;&amp;gt; creator = me.   &lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; is not correct.me is not used as variable . Its only a reference variable.it shoud used me-&amp;gt;class attribute(name)/method..&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not so.  This is perfectly correct.  The method &lt;STRONG&gt;acknowledge&lt;/STRONG&gt; takes an object reference of type ref to "client".  &lt;STRONG&gt;me&lt;/STRONG&gt; fulfills that criterion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2009 08:53:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/example-of-self-reference/m-p/5432382#M1246393</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-04-08T08:53:12Z</dc:date>
    </item>
  </channel>
</rss>

