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: 

Performance in pasing a table to an update function module

Former Member
0 Kudos
176

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

1 ACCEPTED SOLUTION

alex_campbell
Contributor
0 Kudos
90

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.

3 REPLIES 3

yuri_ziryukin
Advisor
Advisor
0 Kudos
90

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

madhu_vadlamani
Active Contributor
0 Kudos
90

Hi Poul,

In general we will use flat tables.Just go through some standard bapi and see.

Regards,

Madhu.

alex_campbell
Contributor
0 Kudos
91

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.