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: 

Returning List of Class Objects from a class method.

0 Kudos
346

Hi,

I have a class method, in that method I will create instances of the same class and I want return those instances as an export parameter. Is there any other way apart from creating a table type of the class and using it as the type of the export parameter. With out creating any global type how can I return list of objects from this class method and how can I read that list in my calling program.

Regards,

Sesh

3 REPLIES 3

Former Member
0 Kudos
156

Hi,

You can try returning the instances individually like

export

instance1

instance2

instance3

But the better and correct way would be using table.

Sameena

0 Kudos
156

Hi,

I dont know how many instances I will have to create inside the method so I have to return a table. I know one way of doing it.

Say my class is CL_CLASS

I can create a table type for CL_CLASS as CL_CLASS_T

and declare one export parameter for the method with type as CL_CLASS_T.

I can return table of objects like this.

I want to know is there any way of doing this with out creating a table type.

Regards,

Sesh

0 Kudos
156

I got the answer that its not possible, hence closing the thread.