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 Tables from Function Question

Former Member
0 Likes
752

This is such a noob question, but I can't figure out if I'm approaching function design correctly. I'm creating a function that returns a list of items. I come from a curly brace language background, and when I want to do something like this in those languages I simply create an object and then return a list containing multiple objects.

Now to my ABAP issue. I have a structure and I want to return a list (internal table) of them. As far as I can tell, to do this I need to create a table type based on this structure and then reference the table type in an exporting parameter. This feels like an unnecessary step to me, so I just want to be sure I'm not missing some other mechanism to accomplish this. Is there not a way to define at the function level that I have a structure and I want to return zero or more of them?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
720

Robin,

There is a Tables parameter also in which you cna pass structure and it will give table values/ Did you try that?

Ravi

3 REPLIES 3
Read only

Former Member
0 Likes
721

Robin,

There is a Tables parameter also in which you cna pass structure and it will give table values/ Did you try that?

Ravi

Read only

0 Likes
720

I may be mistaken, but isn't a Tables parameter for passing data into a function module, not returning data from it?

Also, isn't that functionality obsolete? I realize this doesn't prevent me from using it, but it doesn't seem smart to use things that are obsolete.

Read only

0 Likes
720

Hi Robin,

A tables parameter can be used to return values as well. You are right that Tables parameter is obsolete so it might not be advisable. If you don't want to use tables then you have no other option other than using the table type in export parameters.

Thanks,

Naveen