SAP / styleguides

This repository provides SAP style guides for coding and coding-related topics.
Other
1.68k stars 445 forks source link

RETURNING large tables is usually okay #235

Closed webracer999 closed 1 year ago

webracer999 commented 3 years ago

I'm missing the reason why "RETURNING large tables is usually okay" (Clean ABAP). The reason in my eyes is ABAPs "Sharing Between Dynamic Data Objects" (https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenmemory_consumption_3.htm). So internal tables aren't copied in memory, when they don't differ.

Returning of large tables therefore effectively end in a logical "call by reference". Which can be observed with the debugger.

larshp commented 3 years ago

yea, also see https://blogs.sap.com/2017/07/30/the-mysteries-of-the-returning-parameter/

N2oB6n-SAP commented 1 year ago

That's correct, the reason being the copy-on-write mechanic with respect to the table data should be mentioned.