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

Returning List of Class Objects from a class method.

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,133

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

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
Read only

Former Member
0 Likes
943

Hi,

You can try returning the instances individually like

export

instance1

instance2

instance3

But the better and correct way would be using table.

Sameena

Read only

0 Likes
943

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
943

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