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

Update customised table

Former Member
0 Likes
690

Hi all,

I have 7000 records to be inserted/modified to a customized table. Program will be run everyday at night to update the customised table.

What is the best method to update it? Is it using FM or just put commit after the loop?

many thanks.

5 REPLIES 5
Read only

Former Member
0 Likes
656

Alia,

I am not sure what you are asking about. FM is different from commit after the loop.

Its always better that you update your table with all the records and then finally do a commit, whether you are doing in a program or a function module. If the number of records is too large, you can think of an intermediate commit after say n(1000) records.

Where is the confusion?

Regards,

Ravi

Read only

0 Likes
656

Hi Ravi,

I am sorry if my question is unclear. I am asking about how to update the customised table.

I am thinking of putting commit after the loop, where inside the loop, right now I directly move value to the customised table, for example:

loop at itab.

zso-matnr = itab-matnr.

endloop.

commit work.

or

using a functional module to update entire record:

UPDATE ZSTB_SO_LOG FROM i_logtab.

which one is the best? in term of performance impact etc etc.

many thanks

alia

Read only

0 Likes
656

Alia,

Looks like your internal table is of the same structure as of the database table. In this case you can go with the ONE statement approach.

You are using a UPDATE statement. On the other hand if you have mix of new records as well as updated records you can go for MODIFY statement.

Regards,

Ravi

Note : Please reward points if this helps you.

Read only

Former Member
0 Likes
656

Use array command which will Insert / modiy in one database operation .

MODIFY <DBTAB> from ITAB.

Itab is internal table having same structure as database tables . Beofre doing the above database insert you may like to do all validations on ITAB . In above the Key will be matched . If it exists is db table record will be updated else new record will be inserted.

No specific commit work is required . It will be triggered implicitly the moment the program ends.

Cheers

Read only

Former Member
0 Likes
656

7000 records isn't really a lot. Since each commit has some overhead, I'd just update the records and commit at the end.

rob