‎2009 Jul 09 10:51 AM
hi all,
I have some queires on ooabap interfaces-
1) Is it mandatory to implement all the methods thats are declared in an interface.
***************************************
interface ifac.
methods: i1.
methods:i2.
endinterface.
*************************************
from above example is it mandatory to implement both the methods i1,i2 in a class/every class in the current program.
2)can i implement a particular method(say i2) in a class and vomit i1.
‎2009 Jul 09 10:56 AM
‎2009 Jul 09 12:34 PM
>
> hi all,
> I have some queires on ooabap interfaces-
> 1) Is it mandatory to implement all the methods thats are declared in an interface.
> ***************************************
> interface ifac.
> methods: i1.
> methods:i2.
> endinterface.
> *************************************
> from above example is it mandatory to implement both the methods i1,i2 in a class/every class in the current program.
> 2)can i implement a particular method(say i2) in a class and vomit i1.
I hope you mean "omit 1"....
Anyway - why don't you try it and see what happens. Please post the results back here.
matt
‎2009 Jul 09 12:47 PM
hi matt,
I tried , but its asking for the other method to implement in the same class itself.I taught we can implement either of the method depending on the requirement.what yo say???please let me know if iam wrong.
‎2009 Jul 09 2:25 PM
As your test results say, we have to implement all the methods in the interface.
I taught we can implement either of the method depending on the requirement.
In this type of scenario, create two different interfaces with required methods in them and implement them in respective implementing classes..
Regards,
Naimesh Patel
‎2009 Jul 09 2:27 PM
Hi,
it is mandatory to implemet the all methods of the interface in the class.
if the interface is added in class.
interfaces is added at public section of the class.
Prabhudas
‎2009 Jul 09 4:24 PM
Hi,
all methods of an interface have to be implemented. That's the purpose of an interface, to make sure, that all the methods and attributes defined in an interface are available in all classes implementing this interface.
Regards
Dirk
‎2009 Jul 10 6:00 AM
‎2021 Oct 27 3:47 PM
Hint : Set Default { FAIL / IGNORE } for the methods which you don't want to
impl in the implementing class.
Thanks and rewards if Your problem solved.