<?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: Why is this possible in ABAP Objects? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052282#M1809987</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Emir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quite an interesting question &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following things which i come to my mind right now -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The inheritance is defined statically &amp;amp; 'Protected' components are visible to all the (sub)classes in the inheritance tree. When the compiler statically checks if the instance attribute NAME of the class LCL_PARENT is visible in LCL_CHILD, it finds that it can access. I don't see any reason why the compiler should raise any error/warning on that.&lt;/LI&gt;&lt;LI&gt;There is no need to pass an instance of the parent class to the sub-class. The instance is already available in the runtime via the &lt;EM&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;super&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/EM&gt;variable.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Is anyone else surprised by this? In other languages, I don't think this is allowed.&lt;/P&gt;



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Tbh i'll surprised if other programming languages do not allow it. How would the compiler determine it statically?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Doesn't this make the code less secure?&lt;/P&gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No, for me this is very well within the definitions of OOP. You cannot access the protected elements outside the inheritance tree, but inside it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see what the OO gurus, &lt;A __default_attr="302712" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Paul Hardy" href="https://community.sap.com/"&gt;&lt;/A&gt;, &lt;A __default_attr="24079" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Matthew Billingham" href="https://community.sap.com/"&gt;&lt;/A&gt; , have to say about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS - I have no knowledge of any programming language other than ABAP, so please excuse me for my ignorance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Jan 2014 11:16:55 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2014-01-12T11:16:55Z</dc:date>
    <item>
      <title>Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052281#M1809986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I've being doing ABAP and ABAP Objects for a while now. Then &lt;STRONG&gt;I found out that accessing a protected attribute 'externally' is possible as long as you've initiated the call from inside one of its subclass.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is anyone else surprised by this? In other languages, I don't think this is allowed. Do you think this is a good feature? Doesn't this make code less secure?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the code below, you can see that an instance of lcl_child tried to access the protected attribute 'name' of another instance whose type is lcl_parent - a superclass of lcl_child.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;REPORT YACCESSTEST.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;CLASS lcl_parent DEFINITION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PUBLIC SECTION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; METHODS constructor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMPORTING&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_name TYPE string.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PROTECTED SECTION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA name TYPE string.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDCLASS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;CLASS lcl_parent IMPLEMENTATION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; METHOD Constructor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; name = p_name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ENDMETHOD.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDCLASS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;CLASS lcl_child DEFINITION INHERITING FROM lcl_parent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; PUBLIC SECTION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; METHODS:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Constructor,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMPORTING p_o_parent TYPE REF TO lcl_parent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDCLASS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;CLASS lcl_child IMPLEMENTATION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; METHOD Constructor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; super-&amp;gt;Constructor( 'BABY' ).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ENDMETHOD.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; METHOD Test.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;" Should I be able to access this 'PUBLICLY' because&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;" I'm inside the subclass of lcl_parent? Note that this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;" can be a different instance from me.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WRITE p_o_parent-&amp;gt;name. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ENDMETHOD.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ENDCLASS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DATA:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; o_parent TYPE REF TO lcl_parent,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; o_child&amp;nbsp; TYPE REF TO lcl_child.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;START-OF-SELECTION.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; CREATE OBJECT o_parent EXPORTING p_name = 'MOMMY'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; CREATE OBJECT o_child.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;* WRITE o_parent-&amp;gt;name. " error. not accessible!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; o_child-&amp;gt;Test( o_parent ). " outputs 'MOMMY', why possible?!?!?!?!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Jan 2014 03:00:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052281#M1809986</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-12T03:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052282#M1809987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Emir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quite an interesting question &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following things which i come to my mind right now -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The inheritance is defined statically &amp;amp; 'Protected' components are visible to all the (sub)classes in the inheritance tree. When the compiler statically checks if the instance attribute NAME of the class LCL_PARENT is visible in LCL_CHILD, it finds that it can access. I don't see any reason why the compiler should raise any error/warning on that.&lt;/LI&gt;&lt;LI&gt;There is no need to pass an instance of the parent class to the sub-class. The instance is already available in the runtime via the &lt;EM&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;super&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;/EM&gt;variable.&lt;/LI&gt;&lt;/OL&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Is anyone else surprised by this? In other languages, I don't think this is allowed.&lt;/P&gt;



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Tbh i'll surprised if other programming languages do not allow it. How would the compiler determine it statically?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Doesn't this make the code less secure?&lt;/P&gt;


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No, for me this is very well within the definitions of OOP. You cannot access the protected elements outside the inheritance tree, but inside it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see what the OO gurus, &lt;A __default_attr="302712" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Paul Hardy" href="https://community.sap.com/"&gt;&lt;/A&gt;, &lt;A __default_attr="24079" __jive_macro_name="user" class="jive_macro_user jive_macro" data-orig-content="Matthew Billingham" href="https://community.sap.com/"&gt;&lt;/A&gt; , have to say about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS - I have no knowledge of any programming language other than ABAP, so please excuse me for my ignorance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Jan 2014 11:16:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052282#M1809987</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2014-01-12T11:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052283#M1809988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What we have here is the protected attributes of one instance being accessible from another instance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wouldn't expect the syntax checker to pick it up (it doesn't pick up when the constructor calls the super-constructor which then calls an overrridden method, even though this ends in a dump), but I would expect it to dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm surprised.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Jan 2014 14:53:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052283#M1809988</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2014-01-12T14:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052284#M1809989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I wrote a little Java program based on your ABAP program, just to verify and the result was the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;public class TestProtected {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; public static void main(String[] args) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Parent p = new Parent("mommy");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Child c = new Child();&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; c.test(p);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;class Parent {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; protected String name;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; public Parent(String n) {&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; name = n;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;class Child extends Parent{&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; public Child(){&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; super("baby");&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void test(Parent p){&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; System.out.println(p.name);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Prints Mommy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; System.out.println(super.name);&amp;nbsp; // Prints Baby&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; }&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The checks at runtime must only based on the class definitions, not the specific instance.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Must admit I was suprised about this. I would not write anything in this way, but nevertheless good to know.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 07:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052284#M1809989</guid>
      <dc:creator>Katan</dc:creator>
      <dc:date>2014-01-13T07:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052285#M1809990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Katan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the Java program &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;The checks at runtime must only based on the class definitions, not the specific instance.&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Did you mean runtime or design time?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;I would not write anything in this way, but nevertheless good to know.&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Ditto.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tbh i was not surprised at the behavior of the compiler/runtime environment, but Matt &amp;amp; you seemed to be so &lt;SPAN __jive_emoticon_name="confused" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/confused.gif"&gt;&lt;/SPAN&gt; Am i missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 08:43:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052285#M1809990</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2014-01-13T08:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052286#M1809991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wrote the same in PHP... and it worked too!!! &lt;A href="http://codepad.org/b9y231EN" style="font-family: ariel, sans-serif;" title="http://codepad.org/b9y231EN"&gt;PHP code- 24 lines - codepad&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOOOoo!!! I don't know what to believe in anymore... Is the world flat? Did Neil Armstrong really land on the moon? lol&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 08:45:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052286#M1809991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-13T08:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052287#M1809992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Is the world flat? &lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The world is not flat, for sure!&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Did Neil Armstrong really land on the moon? lol&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now that's debatable &lt;SPAN __jive_emoticon_name="cool" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/cool.gif"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 08:53:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052287#M1809992</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2014-01-13T08:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052288#M1809993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two instance having same variable "name"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/362070" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;each instance has unique values saved &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. &lt;/P&gt;&lt;P&gt;o_parent : name = MOMMY&lt;/P&gt;&lt;P&gt;o_child&amp;nbsp; : name = BABY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while calling a method Test and pass ref. of o_parent &lt;/P&gt;&lt;P&gt;it will simply represent parent's instance and show a value of MOMMY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*i'm just beginner in OO if any correct me..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Avirat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 11:06:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052288#M1809993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-13T11:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052289#M1809994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ehm. I do not see any problem or strange behavior in your example &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see output of protected attribute just because you acces it inside class (which is ok).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;EM&gt;METHOD Test.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-weight: inherit;"&gt;&lt;EM&gt;&amp;nbsp; WRITE p_o_parent-&amp;gt;name. "&amp;lt;- here&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;EM&gt;ENDMETHOD.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this. It wont work same like parent acces of protected attribute:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;EM&gt;WRITE &lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;o_child&lt;SPAN class="L0S70"&gt;-&amp;gt;&lt;/SPAN&gt;name&lt;/EM&gt;&lt;SPAN class="L0S55"&gt;&lt;EM&gt;. "name will still not be accesible outside of class&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;Private attribute is accesible in class only.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;Protected attribute is accesible in class and in its subclass.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;Public is accesible in class, sublass and outside of class.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 11:42:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052289#M1809994</guid>
      <dc:creator>Tomas_Buryanek</dc:creator>
      <dc:date>2014-01-13T11:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052290#M1809995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's an example that removes the question of inheritance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS main DEFINITION.
&amp;nbsp; PUBLIC SECTION.
&amp;nbsp;&amp;nbsp;&amp;nbsp; METHODS show IMPORTING i_ref TYPE REF TO main.
&amp;nbsp;&amp;nbsp;&amp;nbsp; METHODS set IMPORTING i_value TYPE string.

&amp;nbsp; PRIVATE SECTION.
&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA: value TYPE string.

ENDCLASS.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "main DEFINITION

CLASS main IMPLEMENTATION.
&amp;nbsp; METHOD show.
&amp;nbsp;&amp;nbsp;&amp;nbsp; WRITE: i_ref-&amp;gt;value.
&amp;nbsp; ENDMETHOD.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "show

&amp;nbsp; METHOD set.
&amp;nbsp;&amp;nbsp;&amp;nbsp; me-&amp;gt;value = i_value.
&amp;nbsp; ENDMETHOD.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "set

ENDCLASS.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "main IMPLEMENTATION

START-OF-SELECTION.

&amp;nbsp; DATA: ref1 TYPE REF TO main,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ref2 TYPE REF TO main.

&amp;nbsp; CREATE OBJECT: ref1, ref2.
&amp;nbsp; ref1-&amp;gt;set( 'value of ref1' ).
&amp;nbsp; ref2-&amp;gt;set( 'value of ref2' ).

&amp;nbsp; ref1-&amp;gt;show( ref2 )..&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I pass &lt;STRONG&gt;ref2&lt;/STRONG&gt; to &lt;STRONG&gt;Ref1&lt;/STRONG&gt;, then methods within &lt;STRONG&gt;ref1&lt;/STRONG&gt; have access to &lt;STRONG&gt;ref2&lt;/STRONG&gt;'s &lt;STRONG style="color: #ff0000;"&gt;private&lt;/STRONG&gt; attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understood private attributes were private to that instance. But it appears they are only private to that class.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 12:46:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052290#M1809995</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2014-01-13T12:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052291#M1809996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"value" is private &lt;STRONG&gt;for class&lt;/STRONG&gt; not for each object (ref1, ref2..). So ref1 value is visible from ref2 instance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Info from SAP Help on "PRIVATE SECTION" keyword:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;The class is the smallest encapsulation unit in ABAP Objects. This means that a method can use all private components of all instances of the same class...&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps understanding &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 13:14:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052291#M1809996</guid>
      <dc:creator>Tomas_Buryanek</dc:creator>
      <dc:date>2014-01-13T13:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052292#M1809997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well - it's nice to learn something new. It seems common across OO languages, but still seems a bit weird.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 14:04:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052292#M1809997</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2014-01-13T14:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052293#M1809998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quite surprising for sure. However the "test" method isn't something you would find inside lcl_child class. The method parameter is creating a dependency between two instances which actually might be the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instances from the same class should be independent from each other (at least in 99% of the scenarios I can imagine) so you would have to transfer the "test" method to a different class (for example a writer class). As a consequence it wouldn't be possible to access the attribute without a getter or using the READ-ONLY option for the attribute name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 16:57:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052293#M1809998</guid>
      <dc:creator>FabioPagoti</dc:creator>
      <dc:date>2014-01-13T16:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052294#M1809999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nice example Matthew!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A misunderstanding could be solved making "show" a static method.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 17:00:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052294#M1809999</guid>
      <dc:creator>FabioPagoti</dc:creator>
      <dc:date>2014-01-13T17:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052295#M1810000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to know I'm not the only one &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/408/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've always thought of instance-&amp;gt;attribute as a public way of accessing regardless of where the call has been made since you are essentially accessing from the 'outside' of the instance.. I giess i have to remove that from my brain somehow heheh Thanks Matthew!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 04:11:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052295#M1810000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-14T04:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why is this possible in ABAP Objects?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052296#M1810001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes. This is specially true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is quite troubling because it makes it way too easy to access protected variables through 'psuedo' inheritance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I like it that ABAP requires the subclass to call it's superclass' constructor. This gives you a sense of 'responsibility' in creating subclasses specially if you are simply just accessing a wanted attribute. However, because of this, you dont even have to instantiate anything - Just create a static method. So you can do whatever in the constructor. &lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex. below.. I want to get cl_gui_alv_grid from an salv object. r_controller is a protected variable and cl_salv_model_list is the superclass of cl_salv_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L1S52"&gt;CLASS&lt;/SPAN&gt; lcl_hack_salv &lt;SPAN class="L1S52"&gt;DEFINITION&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;INHERITING&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;FROM&lt;/SPAN&gt; cl_salv_model_list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;PUBLIC&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;SECTION&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;CLASS&lt;/SPAN&gt;-&lt;SPAN class="L1S52"&gt;METHODS&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetGrid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;IMPORTING&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p_o_model &lt;SPAN class="L1S52"&gt;TYPE&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;REF&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;TO&lt;/SPAN&gt; cl_salv_model&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURNING&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;VALUE&lt;/SPAN&gt;(r_o_grid) &lt;SPAN class="L1S52"&gt;TYPE&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;REF&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;TO&lt;/SPAN&gt; cl_gui_alv_grid.&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L1S52"&gt;ENDCLASS&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L1S52"&gt;CLASS&lt;/SPAN&gt; lcl_hack_salv &lt;SPAN class="L1S52"&gt;IMPLEMENTATION&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;METHOD&lt;/SPAN&gt; GetGrid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;CHECK&lt;/SPAN&gt; p_o_model-&amp;gt;r_controller-&amp;gt;r_adapter &lt;SPAN class="L1S52"&gt;IS&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;BOUND&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;CALL&lt;/SPAN&gt; &lt;SPAN class="L1S52"&gt;METHOD&lt;/SPAN&gt; p_o_model-&amp;gt;r_controller-&amp;gt;r_adapter-&amp;gt;(&lt;SPAN class="L1S33"&gt;'GET_GRID'&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECEIVING &lt;SPAN class="L1S52"&gt;value&lt;/SPAN&gt; = r_o_grid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L1S52"&gt;ENDMETHOD&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L1S52"&gt;ENDCLASS&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*** call &lt;/P&gt;&lt;P&gt;DATA: o_alv&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;TYPE&lt;/SPAN&gt; &lt;SPAN class="L0S52"&gt;REF&lt;/SPAN&gt; &lt;SPAN class="L0S52"&gt;TO&lt;/SPAN&gt; cl_salv_table,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; o_grid &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 10pt;"&gt;TYPE&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 10pt;"&gt;REF&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN class="L0S52" style="font-size: 10pt;"&gt;TO&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; cl_gui_alv_grid,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; l_o_grid ?= lcl_hack_salv=&amp;gt;getgrid( r_o_alv ). " Static Call! No instantiation required!!!!!&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jan 2014 04:21:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/why-is-this-possible-in-abap-objects/m-p/10052296#M1810001</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-14T04:21:30Z</dc:date>
    </item>
  </channel>
</rss>

