Application Development 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: 

Database Table Update Method

Former Member
0 Kudos

Hi,

Can anybody tell me the right method to update the database tables ? I mean if we want to update ztables we can use insert & commit work or call function in update task.

What r pros n cons associated with update task method ? When should we use update task method ? Is it used only in case of LUW ?

If I have only one screen which is updated by many users simultaneously what will be implications of using update task method ?

Waiting for comments.

Regards,

Nitin

6 REPLIES 6

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Insert command is used to add records in the table.

For updating database table,you can use UPDATE or MODIFY command.

Modify will either insert the record if it does not exist or it will update the record if it exists.

UPDATE dbtab SET f1 ... fn.

UPDATE dbtab.

UPDATE dbtab FROM TABLE itab.

1. MODIFY dbtab. or

2. MODIFY dbtab FROM TABLE itab.

3. MODIFY dbtab VERSION vers.

Effect

Inserts new lines or updates existing lines in a database table (s. relational database). If a line with the specified primary key already exists, an UPDATE is executed. Otherwise, an INSERT is performed. MODIFY belongs to the Open SQL command set.

When the statement has been executed, the system field SY-DBCNT contains the number of edited lines.

For information about LUW,check this link.

http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm

If it is useful,kindly reward points.Otherwise,get back.

0 Kudos

Hi,

I think my question was misinterpreted.

I know the difference between insert, update etc statements.

My question was what are the consequences of updating database using call function .....in update task method.

In what scenarios we should use this method ?

What will be consequences of using this method if I am having a single screen - (single table) updated simultaneously by different users using this method ?

I hope this time my question is clear

Regards,

Nitin

0 Kudos

Hi Nitin,

Check this thread.

0 Kudos

Nitin,

Close the chain appropriately if your question is answered.

Former Member
0 Kudos

Nitin,

We can always use the commmon db manipulation statements on Z tables in our programs. Explicit commit works are not needed as they are taken care implicitly (say for eg, when the program ends successfully !).

Coming to the 'UPDATE TASK', this technique is used to carry out the processing when the commit work is happening. This is to defer the processing which is appropriate only at the time of commit. For eg, while saving a document we might have the attributes corresponding to it right away but the actual document number is not known yet. so when we flag the function to be executed in update task, it is executed during commit work when the info about the document is known.

Let me know if you need further help.

regards,

Pavan.