<?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: Calling inteface methods - which implementation to consider?? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578615#M1660597</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Both&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, somehow I found how it is working in the above case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In here they are passing the ref variable of a class that implements the interface 'if_wd_view' to the method WDDOMODIFYVIEW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hence they could call the method directly using the interface ref instead of the class ref.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, thank you so much for your efforts &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Feb 2012 06:13:34 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-02-02T06:13:34Z</dc:date>
    <item>
      <title>Calling inteface methods - which implementation to consider??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578611#M1660593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to ABAP Objects, but I know Java. So I am trying to learn ABAP comparing with Java but it creating lot of confusions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in a demo program I found the below code : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA tab_root TYPE REF TO cl_wd_uielement_container. 
    DATA structure_root TYPE REF TO cl_wd_uielement_container. 
    DATA new_tab TYPE REF TO cl_wd_table. 

    IF wd_this-&amp;gt;structure_changed = abap_true. 

      structure_root ?= view-&amp;gt;get_element( id = 'FIELD_GROUP' ). 
      tab_root       ?= view-&amp;gt;get_element( id = 'TABLE_GROUP' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In  the above code snippet, &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;structure_root ?= view-&amp;gt;get_element( id = 'FIELD_GROUP' ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; is a downcasting and view is of type ref to IF_WD_VIEW and class cl_wd_uielement_container implements this interface.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, &lt;STRONG&gt;when we do not know which is the implemenation class  for this interface, how can we call a method of this interface (because methods are not implemented in the interface itself but in the implementation class).??&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;In the above assignment statement, how does system finds out which implementation to point to?? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question may be very basic, but i couldnt find the answer for this. &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &lt;/P&gt;&lt;P&gt;Dhananjay Hegde&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 03:41:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578611#M1660593</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-02T03:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calling inteface methods - which implementation to consider??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578612#M1660594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I either didn't understand your question or you answered it yourself. You can't call a method of an interface, only of a class that implements said interface.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 05:19:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578612#M1660594</guid>
      <dc:creator>custodio_deoliveira</dc:creator>
      <dc:date>2012-02-02T05:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calling inteface methods - which implementation to consider??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578613#M1660595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, but if you see in the above statements,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'view' is declared as this -&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;view  type ref to if_wd_view&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  (as a &lt;STRONG&gt;formal parameter to the method WDDOMODIFYVIEW&lt;/STRONG&gt; in a webdynpro application. you can refer the webdynpro app DEMODYNAMIC in SE80 for this).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am trying to understand this. Please help me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 05:24:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578613#M1660595</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-02T05:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calling inteface methods - which implementation to consider??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578614#M1660596</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;First create the instance(object) of class in you were implement interface method then call the interface method using the object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Report  Zinterface,



interface IF_view.

methods: view.

endinterface.

class c1 definition.

public section.

interfaces: IF_view.

methods:m1,m2. " here some more methods.

endclass.

class c1 implementation.

method IF_view~view.

write:/ 'this is an interface method'.
endmethod.

method m1.
write:/ 'this is  M1 method'.
endmethod.

method m2.
write:/ 'this is  M2 method'.
endmethod.
endclass.

data: obj type ref to c1.

START-OF-SELECTION.

create object obj.

call method obj-&amp;gt;IF_view~view." call the interface method using the insatance of where you were implemeted the interface&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above procedure apply for your requirement.. i hope you may get idea about interface method calling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sreenivas.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 05:52:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578614#M1660596</guid>
      <dc:creator>sreenivas_pachva</dc:creator>
      <dc:date>2012-02-02T05:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calling inteface methods - which implementation to consider??</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578615#M1660597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Both&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, somehow I found how it is working in the above case. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In here they are passing the ref variable of a class that implements the interface 'if_wd_view' to the method WDDOMODIFYVIEW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hence they could call the method directly using the interface ref instead of the class ref.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, thank you so much for your efforts &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 06:13:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/calling-inteface-methods-which-implementation-to-consider/m-p/8578615#M1660597</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-02T06:13:34Z</dc:date>
    </item>
  </channel>
</rss>

