Application Development and Automation 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: 
Read only

Dynamic ref to object

Former Member
0 Likes
351

Hi all,

i want to have a class with an import parameter e. g. class_name.

In the class i want to do the following:

data: agent type ref to <class_name>.

Is that possible?

How must i define the import parameter?

regards

2 REPLIES 2
Read only

matt
Active Contributor
0 Likes
334

Class_name could be CLIKE - allowing any character type field.

  DATA: lo_fish TYPE REF TO object.

  CREATE OBJECT lo_fish
    TYPE
      (class_name).

Matt

Read only

Former Member
0 Likes
334

Hi Wolfgang,

what want you make with variable Agent in your Class? Wenn you declare the variable as ref to object (how Matthew has wrote) you can create an Instance but you have no acces to fields and methods of instance. Should you possible use Interface?

Regards Boguslaw