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

performance on mass insert

Former Member
0 Likes
749

Hiii

What is the best way to do mass insert in a custom database table

LOOP ITAB ENQUEUE ENDLOOP

MASS INSERT table from ITAB

LOOP ITAB DEQUEUE ENDLOOP

Note: can there be a performance issue doing it that way? since there are two loop

5 REPLIES 5
Read only

Former Member
0 Likes
681

use

ENQUEUE

INSERT ZTABLE FROM TABLE IT_TABLE.

IF SY-SUBRC IS INITIAL.

COMMIT WORK.

ENDIF.

DEQUEUE

Edited by: Sachin Bidkar on Feb 26, 2010 1:23 PM

Read only

0 Likes
681

please note that here the enqueue i am not locking the whole table but will be locking only the entries data that i am inserting

Read only

0 Likes
681

But this is the standard practice what i mentioned and what i understood and as per information..

Edited by: Sachin Bidkar on Feb 26, 2010 1:51 PM

Edited by: Sachin Bidkar on Feb 26, 2010 1:52 PM

Read only

StMou
Active Participant
0 Likes
681

HI,

Why are you lock entry that not in the system ?

Normally we lock entry to prevent another people to acces to this information.

But in your case, you are alone to have data.

Any row of your internal table are store in DB before ?

Rgds

Read only

Former Member
0 Likes
681

Case 1:

INSERT implies you are pushing new records into your table. In this case you don't have to lock entry by entry and INSERT data into your table. This hampers the performance.

Case 2:

If you are handling an existing record in table, then you must use MODIFY. This statement will over write the existing records with your changes and if a record is not found, it would create a new entry in your table.

If either cases, its better to ENQUE, then do a mass update to table. Then,

if sy-subrc eq 0.

COMMIT WORK.

else.

ROLLBACK.

endif.

then deque.

Hope this helps.

Thanks,

Kiran