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

usage of commit

Former Member
0 Likes
462

Hi all,

I got information from basis that due to my program there were many deadlocks

is it necessary to use commit statement over there

Please look into the code

  • Read all records in active table of ODS into itab_ord

select * from /BIC/AZVFOSDP200

appending corresponding fields of table itab_ord

where /BIC/ZPVIEWDT > '19900101'.

  • Insert Changes

loop at itab_omod where SID eq ' '.

itab_omod-sid = zarequest.

itab_omod-datapakid = zadatapakid.

itab_omod-record = zarecord.

modify itab_omod.

zarecord = zarecord + 1.

insert into /BIC/AZVFOSDP240 values itab_omod.

endloop.

endif.

  • Changing the contents of new table with the value

MODIFY /BIC/AZVFOSDP240 from table itab_neword.

Regards

Path

3 REPLIES 3
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
437

You can use the single modify statement for insertion and updation.

Read the f1 documentation for modify db.

Build the internal table with new and changed values and reflect it in db with a single step.

Read only

Former Member
0 Likes
437

Hi ,

Try to remove insert statement from loop.

Use internal table to collect the records and Update your table from an internal table.

Hope this helps you.

Read only

Former Member
0 Likes
437

insert into /BIC/AZVFOSDP240 values itab_omod.

endloop.
endif.


* Changing the contents of new table with the value
MODIFY /BIC/AZVFOSDP240 from table itab_neword.

Your question can not be answered becasue there is a lot of information missing. I think it is nonsense that you should use a commit, you should commit in principle only at the end.

But it is seems that you insert some lines and that you later modify the same lines, that is incorret. You should change the content of the database table only once. Make you changes in the internal tables and MODIFY at the end.

Performancewise it is probably better, if you can avoid the MODIFY and use INSERTs for the new lines and UPDATES for the already existing lines.