‎2010 Feb 26 11:30 AM
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
‎2010 Feb 26 12:07 PM
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
‎2010 Feb 26 12:47 PM
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
‎2010 Feb 26 12:51 PM
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
‎2010 Feb 26 2:40 PM
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
‎2010 Feb 26 2:53 PM
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