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

ABAP OO Abstract Methods

Former Member
0 Likes
2,033

Hi,

I want to use abstract methods in ABAP. I created an abstract class as base and another 'child' class that extends that class. Now, I want to have different implementations in different child classes. The problem is that the IDE redirects me to the base class when trying to to this. There is no possibility to set the method as abstract.

Do you know if that concept is implemented at all? Maybe I just forgot to configure something?!

What do you propose?

Thank you and best regards,

Daniel

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,141

Hi Daniel,

In the child class,assign the super class as your abstract class and save it.You will get the methods.

Click on the method and Go to redefine button at the corner before the undo button.By this you will be able to write in the child class.

hope this will solve.

Thanks,

Vamsi.

Hi Daniel,

In the child class,assign the super class as your abstract class and save it.You will get the methods.

Click on the method and Go to redefine button at the corner before the undo button.By this you will be able to write in the child class.

hope this will solve.

Thanks,

Vamsi.

6 REPLIES 6
Read only

Former Member
0 Likes
1,141

Hi,

You should REDEFINE the method in your child class,

there is a button (next to Find Next, looking like a pencil) in SE24, Class Overview screen. If you place the cursor on the inherited method and click on this button then you can have a different implementation in your child class..

Hope this helps..

Sri

Read only

Former Member
0 Likes
1,141

You can definately create a abstract class and method in OO ABAP. The only care you need to take is you implement all the abstract methods in child class or declare child class as abstract too. if you dont want to implement all the methods then declare a interface rather than declaring a abstract class. You can have syntaxes from the documentation.

Hope this helps.

Read only

Former Member
0 Likes
1,142

Hi Daniel,

In the child class,assign the super class as your abstract class and save it.You will get the methods.

Click on the method and Go to redefine button at the corner before the undo button.By this you will be able to write in the child class.

hope this will solve.

Thanks,

Vamsi.

Read only

0 Likes
1,141

Hi,

thanks. The redefinition button seems to be new...however it should work.

Regards,

Daniel

Read only

0 Likes
1,141

HI Daniel,

Please close the thread , by assigning points if any of the answers helped you.

Thanks and Regards,

Vamsi

Read only

Former Member
0 Likes
1,141

Hi,

If you are creating Local class using SE38, then just by writing "abstact" to the method it behaves like an abstract method.

If you are creating global class SE24, then genrally all interface methods are "abstract" methods so that we can ihberit and can redefine the methods for example: "IF_FLUSH_NOTIFY~BEFORE_FLUSH_NOTIFY" symbol ~ shows that it is an abstract method in the interface before to that.

So, even if it refer to its base class you can just implement them in the child classes by inheriting it.

Hope this helps you if yes try to assign some app. points.

Regards,

Suman