Skip to Content
Former Member
Dec 18, 2006 at 04:11 PM

Returning Internal Table as Returning Parameter of Method (by Value).


When you return an internal table as the returning parameter of a method, it is passed by value. I understand the concept of passing by value vs. passing by reference, but exactly what this means in this case is ambiguous.

1) It could mean that the entire table, including data, is copied from the local table in the method into the parameter provided by the calling code.

2) Alternatively, it could mean that only the pointer to the table is passed by value and the data is not literally copied from one place in memory to another. This would <b>not</b> be the same as passing by reference. For instance, I believe this is how object references are passed by value.

I want to know how it works, so that I know if there is an efficiency problem with returning a huge table. The returning parameter is wonderful for getter methods, and I prefer to use it over exporting parameters, but I have some concern about passing tables as returning parameters since I don't know how this works.

Can anyone either explain this, or at least make it clear to me whether or not there is an efficiency issue?

Thanks, in advance,