Skip to Content
0
Former Member
Aug 30, 2007 at 07:58 PM

Any way to dynamically add an attribute to a class?

492 Views

Hello!

I have a need to create an attribute in my model class at runtime. I don't want to add the attribute to my model class via SE24, etc. Instead, at runtime of my BSP, I want to be able to programmatically create an attribute in my class. Is it possible to do this?

P.S. I have already read the blogs, etc., about using an attribute in the class that is "TYPE REF TO DATA" and then at runtime using a statement like CREATE DATA...TYPE... to define the "real" data type. I'll spare you the long story, but that type of logic is not working for my specific situation. It would be perfect if I could just wait until runtime to add the attribute to the class and define it as the type that I need. (The type will be dynamic and that is why I must wait until runtime to decide the type of attribute that I need.)

Also, I have downloaded the PDF presentation "ABAP 351: Advanced and Generic Programming in ABAP", but it does not mention this type of functionality.

Thanks in advance for any help you can offer me!

Shannon