<?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: access private method in a class in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692494#M889161</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;Generally users of a class may only access the public components of that class. Sometimes, however, you might want to create a closer link between classes. The concept of friends could be of use here. &lt;/P&gt;&lt;P&gt;In this case a class can permit explicitly named users (friends) to access its protected and private components. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prerequisites&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the users declared to be friends (classes and interfaces) were already created. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select the defining class and change to the Class Editor. &lt;/P&gt;&lt;P&gt;Choose Friends. &lt;/P&gt;&lt;P&gt;Go to change mode. &lt;/P&gt;&lt;P&gt;Under Friends, enter the classes or interfaces for which you want to permit access to the protected and private components of the defining class. &lt;/P&gt;&lt;P&gt;If you specify an interface for Friends, this means that all the classes that implement this interface have access to the protected and private components. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you set the flag to Modeled only, no entry is made in the class pool. The friends relationship is only displayed and managed in the Class Builder. The friends relationship cannot be used at runtime. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the users specified as friends can also access PROTECTED a nd PRIVATE components of the class in question if the Modeled only flag was not set in step 4. The friends relationship is always one-sided and is not inherited. This means that friends of a superclass are not automatically friends of the subclasses. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope this helps, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Apr 2008 08:48:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-11T08:48:25Z</dc:date>
    <item>
      <title>access private method in a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692492#M889159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;i have doubts regarding access of class method.&lt;/P&gt;&lt;P&gt;my scenario is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am having method called &lt;STRONG&gt;M1&lt;/STRONG&gt; which is in &lt;STRONG&gt;class A&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i want 2 access that  method  &lt;STRONG&gt;M1&lt;/STRONG&gt; in &lt;STRONG&gt;Class B&lt;/STRONG&gt; which is different class..&lt;/P&gt;&lt;P&gt;how to do that... how to access????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i want clear explanation with syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;points wil be rewarded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 08:44:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692492#M889159</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-11T08:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: access private method in a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692493#M889160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If this is a private method, you can't access it from another class. Private methods can only be accessed from within the class itself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 08:47:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692493#M889160</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-11T08:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: access private method in a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692494#M889161</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;Generally users of a class may only access the public components of that class. Sometimes, however, you might want to create a closer link between classes. The concept of friends could be of use here. &lt;/P&gt;&lt;P&gt;In this case a class can permit explicitly named users (friends) to access its protected and private components. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Prerequisites&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the users declared to be friends (classes and interfaces) were already created. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Procedure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select the defining class and change to the Class Editor. &lt;/P&gt;&lt;P&gt;Choose Friends. &lt;/P&gt;&lt;P&gt;Go to change mode. &lt;/P&gt;&lt;P&gt;Under Friends, enter the classes or interfaces for which you want to permit access to the protected and private components of the defining class. &lt;/P&gt;&lt;P&gt;If you specify an interface for Friends, this means that all the classes that implement this interface have access to the protected and private components. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you set the flag to Modeled only, no entry is made in the class pool. The friends relationship is only displayed and managed in the Class Builder. The friends relationship cannot be used at runtime. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the users specified as friends can also access PROTECTED a nd PRIVATE components of the class in question if the Modeled only flag was not set in step 4. The friends relationship is always one-sided and is not inherited. This means that friends of a superclass are not automatically friends of the subclasses. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope this helps, Do reward.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 08:48:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692494#M889161</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-11T08:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: access private method in a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692495#M889162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the FRIENDS concept is the one to choose here. another way to achive your goal is to implement a kind of proxy methods (public) which just calls the private methods you have to access...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 08:55:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692495#M889162</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-11T08:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: access private method in a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692496#M889163</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;Say there are two classes class1 and class2.&lt;/P&gt;&lt;P&gt;and method M1 present in class1 as private method.&lt;/P&gt;&lt;P&gt;Now if you want to access this in your method of second class follow the below method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in implementation of method M2.&lt;/P&gt;&lt;P&gt;METHOD M2.&lt;/P&gt;&lt;P&gt;    DATA: class1 TYPE REF TO zclass1,&lt;/P&gt;&lt;P&gt;    CREATE OBJECT class1.  &lt;/P&gt;&lt;P&gt;  CALL METHOD class1-&amp;gt;M1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Award points if you find it useful.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prasanna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 08:57:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692496#M889163</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-11T08:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: access private method in a class</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692497#M889164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Micky,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a requirement where i need access to the private method of a class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My class is - cl_wb_mime_repository&lt;/P&gt;&lt;P&gt;Method is   - preview_mime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i try to acess this method in my Z Program, it gives me a compile error which read as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        "Method "PREVIEW_MIME" is unknown or PROTECTED or PRIVATE."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please let me know how can we get an acess to this method in my Z Program?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Oct 2010 12:18:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/access-private-method-in-a-class/m-p/3692497#M889164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-01T12:18:39Z</dc:date>
    </item>
  </channel>
</rss>

