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

which one is better performance wise

Former Member
0 Likes
1,162

Array Insert VS Single row Insert

LOOP AT IT_TAB INTO WA_TAB.

INSERT INTO CUSTOMERS VALUES WA_TAB.

ENDLOOP.

VS

INSERT CUSTOMERS FROM TABLE IT_TAB.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,081

Hi,

INSERT CUSTOMERS FROM TABLE IT_TAB. is always better.

Try avoiding insert database table statement inside a loop.

Rewards if useful.

Regards,

Nishant

Array Insert VS Single row Insert

LOOP AT IT_TAB INTO WA_TAB.

INSERT INTO CUSTOMERS VALUES WA_TAB.

ENDLOOP.

VS

INSERT CUSTOMERS FROM TABLE IT_TAB.

8 REPLIES 8
Read only

Former Member
0 Likes
1,082

Hi,

INSERT CUSTOMERS FROM TABLE IT_TAB. is always better.

Try avoiding insert database table statement inside a loop.

Rewards if useful.

Regards,

Nishant

Read only

Former Member
0 Likes
1,081

Hi,

INSERT CUSTOMERS FROM TABLE IT_TAB.

Is the best way to insert into datbase table as its 1 shot hit to database.

Performing any operation inside LOOP is always a performance bottleneck.

So insert in a LOOP -- ENDLOOP is not preferred.

Hope this helps you.

thanx,

dhanashri

Read only

Former Member
0 Likes
1,081

Hi,

In case of Inserting Single record through work area

hiting of Databse equals to number of Records in the internal table.So here database access is more.

But if you Insert records through Internal table at a time it access the database for a single time , so the database load is decreasing.

So Performancewise Inserting Records through Internal table ie better.

Regards,

Sujit

Read only

Former Member
0 Likes
1,081

Deepa,

Avoid unnecessary MOVEs by using the explicit work area operations

LOOP AT IT_TAB INTO WA_TAB.

INSERT INTO CUSTOMERS VALUES WA_TAB

where appropriate.

For more infor use SE30>Tips and trick you will find yourself more close to this topic.

Amit.

Read only

Former Member
0 Likes
1,081

hi,

Using INSERT inside a LOOP ENDLOOP statement will give you a very bad performance.

Use INSERT without LOOP ENDLOOP statement for better performance.

Regards

Sumit AGarwal

Read only

Former Member
0 Likes
1,081

Hi,

Use second option becoz it reduce the no of hits from database to insert the new records.

Read only

Former Member
0 Likes
1,081

Hi Deepa,

INSERT CUSTOMERS FROM TABLE IT_TAB is the better option.

Coming to insertion into database, it is not recommended to use INSERT statement, as the database tables are populated using screens, where all the validations and authorizations are done. Whereas INSERT can insert into table without these validations also.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,081

Hi Deepa,

use INSERT CUSTOMERS FROM TABLE IT_TAB.

It is much better performance wise as the database is hit only one time as copmared o loop/emndloop which results in multiple access thereby decreasing performance.

Regards,

Sachin.