‎2008 Jan 11 10:25 AM
Hi i have some doubts about interfaces . can we declares interfaces inside interface ie am talking about classes and interfaces . If possible how to access insider interface and how to implement it. Any information is credited.
thank you .
lavanya
Edited by: lavanya reddy on Jan 11, 2008 11:43 AM
‎2008 Jan 11 10:55 AM
yes we can declare the interface with in the interface.
please check the fallowing program which will describes
the way how to declare the interface with in the another interface and how to implement it.
interface if1.
methods:m1,
m2.
endinterface.
interface if2.
methods:m3.
interfaces:if1.
endinterface.
class a definition.
public section.
interfaces:if2.
endclass.
class a implementation.
method if2~m3.
write:/ 'This is second interface method'.
endmethod.
method if1~m1.
write:/ 'This is first interface method1'.
endmethod.
method if1~m2.
write:/ 'This is first interface method2'.
endmethod.
endclass.
start-of-selection.
data:obj type ref to a.
create object obj.
call method:obj->if2~m3.
call method:obj->if1~m1.
call method:obj->if1~m2.
‎2008 Jan 11 10:31 AM
Have a look at this link.
http://help.sap.com/saphelp_46c/helpdata/en/22/042427488911d189490000e829fbbd/content.htm
Other type of Interfaces are
http://help.sap.com/saphelp_nw70/helpdata/en/ec/d9ab291b0b11d295400000e8353423/content.htm
http://www.erpgenie.com/sap/interfaces/
Reward points if useful.
‎2008 Jan 11 10:55 AM
yes we can declare the interface with in the interface.
please check the fallowing program which will describes
the way how to declare the interface with in the another interface and how to implement it.
interface if1.
methods:m1,
m2.
endinterface.
interface if2.
methods:m3.
interfaces:if1.
endinterface.
class a definition.
public section.
interfaces:if2.
endclass.
class a implementation.
method if2~m3.
write:/ 'This is second interface method'.
endmethod.
method if1~m1.
write:/ 'This is first interface method1'.
endmethod.
method if1~m2.
write:/ 'This is first interface method2'.
endmethod.
endclass.
start-of-selection.
data:obj type ref to a.
create object obj.
call method:obj->if2~m3.
call method:obj->if1~m1.
call method:obj->if1~m2.
‎2008 Jan 11 12:37 PM
hi lavanya,
An interface can be composed of nay number of different component interfaces.All the interfaces are equllay valid on one level.
If a component interface itself is a composite ie,it contains its own component interfaces-then the nesting hierarchy is irrevelant for the composition of the interface.it is relevant ,however for accessing the interface components.
To access sa component comp of a component interface ifac within a composite interface,you can use the expression ifaccomp with the interface component selector().Multiple use of interface component selector in an identifier (such as ifac1ifac2comp ) is generally not supported.
regards,
sravanthi
‎2008 Jan 11 12:39 PM