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 Statement

Former Member
0 Likes
719

Which of these statements is correct. caz the ABAP editor gives no syntax error on any of these.

UPDATE PA0003 SET AEDTM = SY-DATUM UNAME = SY-UNAME BDERR =

VALID_DATE WHERE PERNR = INNNN-PERNR.

UPDATE PA0003 SET: AEDTM = SY-DATUM , UNAME = SY-UNAME , BDERR = VALID_DATE WHERE PERNR = INNNN-PERNR.

6 REPLIES 6
Read only

Former Member
0 Likes
658

Both are correct

Read only

Former Member
0 Likes
658

If both statement is true.

Then plz debugg your program and see the above mentioned syantax effec. As data is coming properly or not.

regards,

rewards point.

Read only

Former Member
0 Likes
658

Hi,

Try this one always put try code when use update.

TRY.

UPDATE (table)

SET (set_expr)

WHERE (condition).

CATCH cx_sy_dynamic_osql_error.

MESSAGE `Error in update!` TYPE 'I'.

ENDTRY.

Rewards points if it is useful.

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
658

Hi,

Both are correct <b>as you might be knowing ':' is the operator used to list objects seperated by commas the second syntax is also fine.</b>

Regards,

Sesh

Read only

Former Member
0 Likes
658

<b>both do the same</b>.

In 1st stament u r updating AEDTM , UNAME , BDERR fields of DB table hitting it only once.

In 2nd stament u r updating AEDTM , UNAME , BDERR fields of DB table one by one hitting the table thrice.

So 2nd is prefferable.

reward if helpful

Read only

0 Likes
658

For the 1st statement i got the three fields updated for the given PERNR

But the second statement changes BEDRR field of the given PERNR and AEDTM and UNAME for each and every entry in the table. damn it changes the whole table.

Message was edited by:

bilal sohaib