<?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: Nested interfaces and abstract methods in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906748#M1597384</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Changing the order works, thanks!&lt;/P&gt;&lt;P&gt;&amp;gt; It does look like this has to be done manually in a global class though.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, you don't have to manually do this while defining a similar global class. The class builder automatically maintains the order of the definition!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 May 2011 10:06:36 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2011-05-17T10:06:36Z</dc:date>
    <item>
      <title>Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906742#M1597378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Consider the following design:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
interface ZIF_INTERFACE_A.
  methods METHOD_A.
endinterface.

interface ZIF_INTERFACE_B.
  interfaces ZIF_INTERFACE_A.
  methods METHOD_B.
endinterface.

class CLASS_A_B definition abstract.
public section.
  interfaces ZIF_INTERFACE_B
    abstract methods METHOD_B.
  interfaces ZIF_INTERFACE_A
    abstract methods METHOD_A.
  methods METHOD_C.
endclass.
class CLASS_A_B implementation.
  method METHOD_C.
  endmethod.
endclass.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When trying to implement this design, the syntax check is giving me an error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;The method "METHOD_A" was declared as not ABSTRACT in a previous INTERFACES statement.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I implement the design with Java (either using a public nested interface, or using interface inheritance) there is no problem declaring both the methods METHOD_A and METHOD_B as abstract in the CLASS_A_B class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it seems to me this might be a bug in the ABAP Objects implementation. Or perhaps I am missing something else here? Does anyone have any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 May 2011 23:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906742#M1597378</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-16T23:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906743#M1597379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems like a bug.&lt;/P&gt;&lt;P&gt;Class declaration should look like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;class CLASS_A_B definition abstract.
public section.
  interfaces ZIF_INTERFACE_B
    abstract methods METHOD_B METHOD_A.
  methods METHOD_C.
endclass.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;class CLASS_A_B definition abstract.
public section.
  interfaces ZIF_INTERFACE_B
    abstract methods METHOD_B zif_interface_a~method_a .
  methods METHOD_C.
endclass.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but both options give syntax errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a workaround you can use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS class_a_b DEFINITION ABSTRACT.
  PUBLIC SECTION.
    INTERFACES zif_interface_b
      ALL METHODS ABSTRACT.

    METHODS method_c.
ENDCLASS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which works fine&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 07:03:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906743#M1597379</guid>
      <dc:creator>former_member182670</dc:creator>
      <dc:date>2011-05-17T07:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906744#M1597380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Nested interfaces&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you include an IF in another IF both of them will exist on the same level, there is no concept of hierarchy. So when you add interface ZIF_B in the implementing class ZCL_A_B, the interface ZIF_A is also "included" in the relationship with the class ZCL_A_B implicitly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just try to activate the code below &amp;amp; you'll get the error: "Implementation missing for method zif_interface_a~method_a":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS class_a_b DEFINITION ABSTRACT.
  PUBLIC SECTION.
*    INTERFACES zif_interface_a
*      ABSTRACT METHODS method_a.
    INTERFACES zif_interface_b
      ABSTRACT METHODS: method_b.
    METHODS method_c.
ENDCLASS.                    "CLASS_A_B DEFINITION&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS class_a_b DEFINITION ABSTRACT.
  PUBLIC SECTION.
    INTERFACES zif_interface_b
      ABSTRACT METHODS method_b.
    INTERFACES zif_interface_a
      ABSTRACT METHODS method_a.
    METHODS method_c.
ENDCLASS.                    "CLASS_A_B DEFINITION&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when the compiler is trying to compile your code it encounter implementation of ZIF_INTERFACE_B it finds that the "included interface" method ZIF_INTERFACE_A&lt;SUB&gt;method_a is not abstract. So when you declare ZIF_INTERFACE_A&lt;/SUB&gt;method_a as "abstract" in the next line the compiler throws this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you need to define ZIF_INTERFACE_A~method_a as abstract, before defining ZIF_INTERFACE_B. Like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS class_a_b DEFINITION ABSTRACT.
  PUBLIC SECTION.

    INTERFACES zif_interface_a
      ABSTRACT METHODS method_a.

    INTERFACES zif_interface_b
      ABSTRACT METHODS method_b.
    
    METHODS method_c.
ENDCLASS.                    "CLASS_A_B DEFINITION&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case the compiler treats &lt;EM&gt;method_a&lt;/EM&gt; as abstract while checking ZIF_INTERFACE_B. Hence it doesn't throw any error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope i'm clear.&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: Whenever i face any problem while creating local classes, i create a dummy class in the class builder to check &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 07:09:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906744#M1597380</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-05-17T07:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906745#M1597381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good points Suhas. Definitely the order of declaration matters here. I didn't think about it in the first place.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 07:13:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906745#M1597381</guid>
      <dc:creator>former_member182670</dc:creator>
      <dc:date>2011-05-17T07:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906746#M1597382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Tomek Mackowski&lt;/P&gt;&lt;P&gt;I do not want all methods to become abstract (there are more methods inside the interfaces which I did not copy into my example).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 07:17:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906746#M1597382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-17T07:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906747#M1597383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Suhas Saha:&lt;/P&gt;&lt;P&gt;Changing the order works, thanks!&lt;/P&gt;&lt;P&gt;It does look like this has to be done manually in a global class though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 07:19:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906747#M1597383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-17T07:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906748#M1597384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Changing the order works, thanks!&lt;/P&gt;&lt;P&gt;&amp;gt; It does look like this has to be done manually in a global class though.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, you don't have to manually do this while defining a similar global class. The class builder automatically maintains the order of the definition!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 10:06:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906748#M1597384</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-05-17T10:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Nested interfaces and abstract methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906749#M1597385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;No, you don't have to manually do this while defining a similar global class. The class builder automatically maintains the order of the definition!&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Actually, I did have to do that. The class builder declared the interfaces in the wrong order.&lt;/P&gt;&lt;P&gt;I only wrote the local classes to demonstrate the problem on this forum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 May 2011 10:38:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/nested-interfaces-and-abstract-methods/m-p/7906749#M1597385</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-05-17T10:38:13Z</dc:date>
    </item>
  </channel>
</rss>

