Application Development 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: 

Exporting and returning value question

Former Member
0 Kudos

What is different between exporting and returning value in method of a class. if created an object inside the method and exporting it, it means I have a reference to that object inside program. If I use returning value, it means I have a copy of object created inside the method, but the object inside method is destroyed after it ends. Do I understand correctly? if so what do u prefer exporting or returning value? thanks!

3 REPLIES 3

narin_nandivada3
Active Contributor
0 Kudos

This message was moderated.

uwe_schieferstein
Active Contributor
0 Kudos

Hello Anthony

The major difference is that you can have multiple EXPORTING parameters yet only a single RETURNING parameter. In addition, if you have a RETURNING parameter you cannot have EXPORTING parameters simultaneously.

Defining methods with a single RETURNING parameter is more Java-like than having multiple EXPORTING parameters.

Whenever possible and sensible I prefer RETURNING parameters over EXPORTING parameters because they allow to use the function method call, e.g.:

go_msglist = cf_reca_messagelist_create( ).

Regards

Uwe

Former Member
0 Kudos

Thanks, you make it clear.