Skip to Content
Oct 22, 2009 at 08:53 AM

Classes name decided at runtime


Hi experts.

I have to build a program, or more ones, to get several files which have some little differences among them.

I thought to do a father class with the common fields, and after that to get a son class for each file, filling the other fields.

My opinion is that the best thing is to use a parameter with the final class name, so I would have only one create statement.

I have two parameters in my constructor.

I follow this way:

DATA: istanza TYPE REF TO Zclassname.


PARAMETERS : t_class1 TYPE zcolt_rf0000-classe

MATCHCODE OBJECT zcolt_rf0000_sort.


CREATE OBJECT istanza TYPE (t_class1)


i_selvbeln = s_vbeln[]

i_fkdat = s_fkdat[].

T_class1 contains the name of the class, i_selvblen and ifkdat are two parameters.

I have two problems:

1) When I try to active the class I get the error "You cannot use constructor paramters in a dynamic create object"

2) But really it's an "almost dynamic create object", because I can't declare a generic class. How can I get the Zclassname as the name contained in t_class1? Ho must I declare it?

Thanks for your future helps.