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 as value parameters in functional methods

Former Member
0 Likes
613

Hi OO experts,

I am interested in what is a 'preferred approach' for using functional methods. Functional methods are very neat and I use them a lot for calculations or for returning single values from table read statements etc.

A returning parameter in a functional method is by VALUE.

But I see these methos also widely used in some of the ABAP OO literature for returning tables.

I would have thought that it's better to use an exporting parameter for a table since that is by REFERENCE and does not explicitly pass the data...

Is there not a performance hit incurred when using returning parameters in functional methods for tables as opposed to using exporting parameters in normal methods?

Cheers,

Gav

3 REPLIES 3
Read only

Former Member
0 Likes
565

Hi Gavin

Yes there is a performance difference. For large internal tables, pass by reference will always give a better performance. It is strongly advised that pass by reference is used with table passing.

This link might help.

http://help.sap.com/abapdocu_70/en/ABENFORMAL_PARAMETERS_OVIEW.htm

Nandesh

Edited by: Nandesh Nair on Nov 19, 2009 6:34 AM

Edited by: Nandesh Nair on Nov 19, 2009 6:35 AM

Read only

MarcinPciak
Active Contributor
0 Likes
565

Actually we can pass a reference to a table rather than a table itself. What we need is something I described here

I really recommend sticking to using functional methods as they introduce nice way of programming and we are sure at first glance, by looking at returning parameter, what the method is responsible for (what is really calcuating at output).

Regards

Marcin

Read only

Former Member
0 Likes
565

Thanks for the replies guys.