Application Development 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: 

error while redefining a class method derived from superclass

Former Member
0 Kudos

Hi,

I am not very familiar with ABAP. when am redefining a method of a class which is derived from a superclass in BW, i'm getting an error saying that the method is already defined.

these are the steps i followed.

1. create a class

2. after creating class, click on attributes tab and select superclass and assigned superclass in this field.

3. after inheriting all methods of its superclass, click on methods and select the method (method1) and click on "redefine" icon. I had put necessary ABAP code on the next screen.

4. when am activating, I'm getting an error that says the method (method1) is already defined with options "activate anyway", "process errors", "cancel".

I'm getting desired result if i select "process anyway", but am not sure if the error might cause other problems even after i activate the erroneous method.

thanks

1 REPLY 1

joerg_wegener
Explorer
0 Kudos

Hi hari143,

in ABAP Objects you can only override instance methods, not class methods. So your assumption that you might get into trouble later if you compile the coding could be true.

If your class does not need more than one instance (for example, because it is stateless or contains only class methods), a singleton is a viable alternative.

Maybe this clarifies things a little bit...

Best regards

Joerg