Skip to Content

Returning List of Class Objects from a class method.

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 14, 2006 at 10:19 AM

    Hi,

    You can try returning the instances individually like

    export

    instance1

    instance2

    instance3

    But the better and correct way would be using table.

    Sameena

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • Posted on Jan 30, 2008 at 08:31 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.