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: 

single Update stmt.. for 2 fields

0 Kudos

Hi everyone,

I have to update 2 fields in my table zsd47_loc_master. I have used 2 update stmts.. for each field. Is it possible to update the table using single stmt.. ?

UPDATE zsd47_loc_master SET capacity = capacity - 1

WHERE location = wk_location

AND status = 'A'.

UPDATE zsd47_loc_master SET status = 'P' WHERE location = wk_location

AND status = 'A'.

thanks in advance,

regards,

Stanley.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Try the following syntax

  UPDATE zsd47_loc_master
    SET: capacity = capacity - 1,
         status = 'P'
    WHERE location = wk_location
      AND status = 'A'.

Regards

4 REPLIES 4

Former Member
0 Kudos

HI,

You can use a single statment ..

UPDATE zsd47_loc_master

SET capacity = capacity - 1

status = 'P'

WHERE location = wk_location

AND status = 'A'.

Regards

Sudheer

Former Member
0 Kudos

Hi Jose,

Yes, You can do this with the help : in ABAP and don't forget to put comma after setting a value to the field.

UPDATE zsd47_loc_master

<b>SET: capacity = capacity - 1,

status = 'P'</b>

WHERE location = wk_location

AND status = 'A'.

Check this link which has example

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/update.htm

<b>Friendly Note:</b> You have many open threads and Plz close the threads if they are answered/solved and reward points to the people who are helping you.

Thanks,

Vinay

Former Member
0 Kudos

Use a single update statement.


UPDATE zsd47_loc_master SET: capacity = capacity - 1
status = 'P'
WHERE location = wk_location
AND status = 'A'.

Please mark points if the solution was useful.

Regards,

Manoj

raymond_giuseppi
Active Contributor
0 Kudos

Try the following syntax

  UPDATE zsd47_loc_master
    SET: capacity = capacity - 1,
         status = 'P'
    WHERE location = wk_location
      AND status = 'A'.

Regards