2012 Jan 09 12:18 PM
Hi.
I am receiving apr. 1000 external calls through a webservice, receiving data in a structure. I want to redesign the solution to make one call receiving 1000 rows in a table instead. In my receiving method i want to call a function module in update task to be able to close the external call ASAP.
In an update function, all parameters are transferred by value, but as for large tables i have heard rumours that there is a difference in performance in how you pass the table:
1. Importing parameter is a table (defined with a table type).
2. Importing parameter is a deep structure (defined with a structure with a component defined with a table type).
I can not see how this could make a difference, but i just wanted to be certain before making a descision.
Can anyone confirm or deny this rumour - and if it is confirmed also explain why.
Thanks
Best regards
Poul Steen Hansen
Senior Technical Consultant
2012 Jan 11 10:35 PM
This post from a few days ago accidently addresses this question:
In a nutshell, when you copy (or pass) a table by value, initially only the pointer to the table is copied. The table data is only copied at the subsequent point in the code where the table data diverges. This allows the best-of-both-worlds in terms of efficiency. For example:
i_tab2 = i_tab1
" At this point, i_tab2 only points to the data from i_tab1, no data in i_tab1 has been copied
APPEND INITIAL LINE TO i_tab2.
" At this point, the data from i_tab1 is copied into i_tab2, and an initial line is appended to i_tab2.
Unfortunately, it's my understanding that this feature does not work for deep structures. When you make a copy of a deep structure, all of the tables which it contains are copied completely at the time of copy. For example:
a_tables2 = a_tables1
" At this point, all data in a_tables1 have been copied into a_tables2
I believe this is why passing a deep structure by value performs worse than passing a table by value.
2012 Jan 09 3:29 PM
Hello Poul,
as far as I remember, when you define parameters in the RFC-enabled function modules you get a warning that the usage of deep structures has negative effect on performance. I would use a normal flat table.
Regards,
Yuri
2012 Jan 09 4:31 PM
Hi Poul,
In general we will use flat tables.Just go through some standard bapi and see.
Regards,
Madhu.
2012 Jan 11 10:35 PM
This post from a few days ago accidently addresses this question:
In a nutshell, when you copy (or pass) a table by value, initially only the pointer to the table is copied. The table data is only copied at the subsequent point in the code where the table data diverges. This allows the best-of-both-worlds in terms of efficiency. For example:
i_tab2 = i_tab1
" At this point, i_tab2 only points to the data from i_tab1, no data in i_tab1 has been copied
APPEND INITIAL LINE TO i_tab2.
" At this point, the data from i_tab1 is copied into i_tab2, and an initial line is appended to i_tab2.
Unfortunately, it's my understanding that this feature does not work for deep structures. When you make a copy of a deep structure, all of the tables which it contains are copied completely at the time of copy. For example:
a_tables2 = a_tables1
" At this point, all data in a_tables1 have been copied into a_tables2
I believe this is why passing a deep structure by value performs worse than passing a table by value.