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

Too many insert statements executed corresponding to one Insert statement

ankur_malik
Product and Topic Expert
Product and Topic Expert
0 Likes
616

Hi,

I have 2 tables. The first table has 21 fields and the 2nd table has 54 fields. I am inserting 10 records each into both the tables using following insert statement: "INSERT (<ls_data>-database_table) FROM TABLE <lt_table>." This means that above mentioned Insert statement is executed once for each table.

But when i see SQL trace in ST05, i see that there is only 1 insert for the 1st table but for the 2nd table it shows 10 inserts.

Can anyone suggest where the problem is?

Thanks and Best Regards,

Ankur

3 REPLIES 3
Read only

Former Member
0 Likes
568

Hi Ankur,

Can you show your complete code.

Regards,

Atish

Read only

ankur_malik
Product and Topic Expert
Product and Topic Expert
0 Likes
568

Hi Atish,

Actually the code is very simple. I do a loop for both the tables. Inside the loop i populate internal table (<lt_table>) with 10 records with the data for that table. And finally, using following statement i do an insert:

INSERT (<ls_data>-database_table) FROM TABLE <lt_table>.

When i debug everything looks ok. This insert statement is called only twice, once for each table. I can see 10 records inserted in each table. But, ST05 shows different results.

Best Regards,

Ankur

Read only

Former Member
0 Likes
568

Hi Ankur,

the SAP kernel has multiple layers, one is the database interface. This decides how a statement is processed against the database. I assume that your 2nd table is much wider than the 1st one (wider here means more characters / bytes per row, not more columns), or it contains a string or xstring column. In those cases the inserts could not be processed by array inserts (at least not on all databases). Then you see single row inserts in ST05. But normally you should not be concerned by the number of Insert statements. The kernel always try to optimize the performance in respect of the features of the underlying database.

Regards

Ralph