Skip to Content
0
Nov 19, 2008 at 01:20 PM

Dynamically instantiation of an object

271 Views

Hi all,

please forgive my noobiness, I'm a newbie with abap.

I created a "super" class, say A. A contains some methods. Then I declared some classes, say B, C, D, that extend the super class A. These classes inherit from A all the method definition and implementation, and then add two methods that are specific for the single class. These two methods have an identical declarative part (e.g., B, C and D have the same "foo" method, with same parameters, even tho the implementation if it is specific for every class).

I'd like to declare in my report a single object and then, at runtime, decide to instantiate a object from B, C or D dinamically, e.g. depending on certain condition. Is there a way to get this behaviour?

Thanks in advance 😊