Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

methods declared in interfaces

Former Member
0 Likes
1,002

Where can I see the implementation of methods, declared in Interfaces?

<b>For ex:</b> There is one interface <b>if_ixml_element</b> and <b>get_value()</b> is its method. Now where can I see the implementation of get_value() method, as methods are not implemented in interfaces, please provide some information.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
859

hi,

We can see the implementation of interface method in

the <b>IMPLEMENTATION CLASS of INTERFACE</b>.

analyse this program, you clearly find where the methods of interface are implemented.

INTERFACE I_COUNTER.

METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,

INCREMENT_COUNTER,

GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.

ENDINTERFACE.

CLASS C_COUNTER1 DEFINITION.

PUBLIC SECTION.

INTERFACES I_COUNTER.

PRIVATE SECTION.

DATA COUNT TYPE I.

ENDCLASS.

CLASS C_COUNTER1 IMPLEMENTATION.

<b> METHOD I_COUNTER~SET_COUNTER.

COUNT = SET_VALUE.

ENDMETHOD.</b>

METHOD I_COUNTER~INCREMENT_COUNTER.

ADD 1 TO COUNT.

ENDMETHOD.

<b>METHOD I_COUNTER~GET_COUNTER.

GET_VALUE = COUNT.

ENDMETHOD.</b>

ENDCLASS.

regards,

Ashokreddy.

Message was edited by:

Ashok Reddy

5 REPLIES 5
Read only

Former Member
0 Likes
859

Hi,

look here:

Methods of Class CL_GUI_ALV_GRID

See this link

http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5533cd30911d2b467006094192fe3/content.htm

Also see this

http://help.sap.com/saphelp_erp2004/helpdata/en/0a/b5531ed30911d2b467006094192fe3/content.htm

Refresh grid display

Use the grid method REFRESH_TABLE_DISPLAY

Example:

CALL METHOD go_grid->refresh_table_display.

Regards

Read only

Former Member
0 Likes
859

Thanks,

But you are telling about methods of class. I am concerned with methods of interfaces

Read only

uwe_schieferstein
Active Contributor
0 Likes
859

Hello Vinayak

The classes and interfaces for XML handling are somewhat special.

Have a look at the sample report <b>T_PARSING_FILE</b> (package <b>SIXML</b>):

* create the ixml main factory
  ixml = cl_ixml=>create( ).

Here is the coding of the CREATE method (in include <b>BCCIIXML_LCLD</b>):

method create.
 if not the_iXML is initial.
    rval = the_iXML.
  else.
    data: begin of classes,
...
           ref_14 type ref to cl_ixml_element,  " class of our interest
           iid_15 type i value 140,
...
ENDMETHOD.

Double-click on CL_IXML_ELEMENT leads to the class definition (same include):

*--------------------------------------------------------
* cl_ixml_element definition
*--------------------------------------------------------


class cl_ixml_element definition
  inheriting from cl_ixml_node.

  public section.

  interfaces:
    if_ixml_element.  " the class implements the interface IF_IXML_ELEMENT

  methods:
    destructor not at end of mode.

endclass.

You will find the class implementation in include <b>BCCIIXML_LCLI</b>:

*--------------------------------------------------------
* cl_ixml_element implementation
*--------------------------------------------------------


class cl_ixml_element implementation.

    method destructor.
       system-call c-destructor 'xm_CDestr_Unknown' using m_pointee.
    endmethod.

    method if_ixml_element~get_attribute
       by kernel module abkm_iXMLElement_GetAttribute.
    endmethod.

    method if_ixml_element~get_attribute_ns
       by kernel module abkm_iXMLElement_GetAttributeNS.
    endmethod.

    method if_ixml_element~set_attribute
       by kernel module abkm_iXMLElement_SetAttribute.
    endmethod.

    method if_ixml_element~set_attribute_ns
       by kernel module abkm_iXMLElement_SetAttributeNS.
    endmethod.
...

Thus, it appears that the implementation of these classes are integrated into the SAP-kernel.

Regards

Uwe

Read only

Former Member
0 Likes
860

hi,

We can see the implementation of interface method in

the <b>IMPLEMENTATION CLASS of INTERFACE</b>.

analyse this program, you clearly find where the methods of interface are implemented.

INTERFACE I_COUNTER.

METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,

INCREMENT_COUNTER,

GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.

ENDINTERFACE.

CLASS C_COUNTER1 DEFINITION.

PUBLIC SECTION.

INTERFACES I_COUNTER.

PRIVATE SECTION.

DATA COUNT TYPE I.

ENDCLASS.

CLASS C_COUNTER1 IMPLEMENTATION.

<b> METHOD I_COUNTER~SET_COUNTER.

COUNT = SET_VALUE.

ENDMETHOD.</b>

METHOD I_COUNTER~INCREMENT_COUNTER.

ADD 1 TO COUNT.

ENDMETHOD.

<b>METHOD I_COUNTER~GET_COUNTER.

GET_VALUE = COUNT.

ENDMETHOD.</b>

ENDCLASS.

regards,

Ashokreddy.

Message was edited by:

Ashok Reddy

Read only

Former Member
0 Likes
859

Hi Vinayak,

Implementation of methods of interfaces can be found in classes that implement the interface.

So using "where used list" you can find the classes that implement the interface and then find which class implements the required method.

Award points if found useful.

Regards

Indrajit