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 command

Former Member
0 Kudos
616

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
Read only

Former Member
0 Kudos
589

hi ,

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

Regards

Pinaki

Read only

Former Member
0 Kudos
589

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

Read only

Former Member
0 Kudos
589

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.

Read only

Former Member
0 Kudos
589

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

which satisfy the key fields.

Read only

Former Member
0 Kudos
589

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.

Read only

Former Member
0 Kudos
589

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

Read only

Former Member
0 Kudos
589

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.

Read only

0 Kudos
589

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.

Read only

Former Member
0 Kudos
589

Hi,

You have written the query like that.

Is It should not been updated?

Read only

Former Member
0 Kudos
589

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

Read only

Former Member
0 Kudos
589

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.

Read only

Former Member
0 Kudos
589

Thanks