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: 

Update command

Former Member
0 Kudos

Hi experts,

I have a problem with update command. It updates all the rows in my database. Id is a key field, but it updates all the rows, not only that rows where id = k_id

UPDATE z_mytab SET: mod = k_mod,

ftip = k_ftip,

name = k_name

WHERE id EQ k_id.

Edited by: mrwhite on Feb 18, 2009 11:49 AM

12 REPLIES 12

Former Member
0 Kudos

hi ,

According to your query all id will be modified which have the id specified in k_id.

Regards

Pinaki

Former Member
0 Kudos

Hi,

Refer to the following link to know more about Syntex of update command.

http://help.sap.com/saphelp_nw04s/helpdata/en/eb/805a4201301453e10000000a155106/frameset.htm

Regards

Rajesh Kumar

Former Member
0 Kudos

Hi.... It won't update where ever that WHEE criteria is matched. To update u need to use key fields in WHERE condition.

Regards,

KP.

Former Member
0 Kudos

in the where conditions give key fields also so that it will update the particular row

which satisfy the key fields.

Former Member
0 Kudos

Hi ,

I suppose you must go with the modify command with the syntax

Modify z_mytab transporting a b c.

Try if this helps.

Sumit.

Former Member
0 Kudos

I'm using the key field, or should I give mandt also?

Former Member
0 Kudos

Hello

SAP wrote:

If there is no WHERE clause, all lines (in the current client) are updated. If a WHERE condition is specified, only those records which satisfy the WHERE condition are updated.

0 Kudos

I have the where clause, but something should be wrong with my update statement, because it updates all the rows in my table. I have only 1 keyfield 'ID' and I'm using it. So that's why I don't understand why is it wrong.

Former Member
0 Kudos

Hi,

You have written the query like that.

Is It should not been updated?

Former Member
0 Kudos

Hi,

you have to use in loop or you have to put the data which you want keep in database table using following stmt

UPDATE dbtab FROM TABLE itab

Thanks

Parvathi

Former Member
0 Kudos

Okay I've got the problem:

UPDATE z_mytab SET: mod = k_mod,

ftip = k_ftip,

name = k_name

WHERE id EQ k_id.

it should be without ':' like this:

UPDATE z_mytab SET mod = k_mod,

ftip = k_ftip,

name = k_name

WHERE id EQ k_id.

Former Member
0 Kudos

Thanks