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

problem in interfaces

Former Member
0 Likes
1,427

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.

8 REPLIES 8
Read only

premal_mistry2
Active Participant
0 Likes
1,285

This message was moderated.

Read only

matt
Active Contributor
0 Likes
1,285

>

> 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

Read only

Former Member
0 Likes
1,285

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.

Read only

naimesh_patel
Active Contributor
0 Likes
1,285

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

Read only

Former Member
0 Likes
1,285

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

Read only

dirk_wittenberg
Contributor
0 Likes
1,285

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

Read only

0 Likes
1,285

hi guys,

Thank you problem solved..

Read only

0 Likes
1,285

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.