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: 

Create static class dynamically

AntonPierhagen
Active Participant
0 Kudos
316

Hi!

I would like to create an abstract class dynamically.

I can instantiate a public class via:

data: lva_object type ref to zif_class,

lva_type type string value 'ZCL_CLASS'.

create object lva_object type (lva_type).

But how do i do that if i have a abstract class?

For example i have a interface:

ZIF_ABSTRACT_INTERFACE.

From this interface i made a class:

ZCL_ABSTRACT_CLASS.

And if i have an object:

data:

lva_abstract_object type ref to zif_abstract_interface,

lva_abstract_type type string value 'ZCL_ABSTRACT_CLASS'.

How do i assign this type dynamically to the class variable?

1 ACCEPTED SOLUTION

gabmarian
Active Contributor
155

You cannot create instances of an abstract class, this is a key part of the concept. Only concrete subclasses derived from ZCL_ABSTRACT_CLASS can be instantiated.

1 REPLY 1

gabmarian
Active Contributor
156

You cannot create instances of an abstract class, this is a key part of the concept. Only concrete subclasses derived from ZCL_ABSTRACT_CLASS can be instantiated.