on 06-22-2005 2:31 PM
Hello, here is my dilemma:
Class B inherits from Class A. Classes C and D inherit from Class B.
I need to test if object O is an instance of Class A or any of its subclasses (ie Class A, B, C or D). Using the method GET_RELATIVE_NAME is not suitable because then I must know the actual name of the subclass, which I will not. The methods APPLIES_TO and APPLIES_TO_CLASS do not seem to account for inheritance (ie Class D APPLIES_TO Class A is false, even though Class A is a superclass of Class D).
Any feedback would be very nice. I'd like to accomplish this, if possible, using RTTI since it is more elegant than simply casting the object into a reference of type Class A and seeing if an error is thrown.
I'm on 4.7, WebAS 6.30.
Cheers,
Mike
I know this is NOT a RTTI way of doing this task and I can tell you from looking for hours at RTTI that it does not look at the information in this "bottom-up" manner. Although, this would be totally unsupported you can recursivley read the VSEOEXTEND table. That table keeps the relations of all classes and sub-classes. Sadly, CL_ABAP_CLASSDESCR is marked as final so you can't even subclass it to add this functionality.
hope this helps.
-d
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.