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/Modify not working

former_member5472
Active Contributor
0 Likes
954

hi,

i have ztable

mandt key field

ztest1 key field

ztest2 key field

ztest2 non key field

when i'm trying to modify any key field, MODIFY keyword is actually adding a new record in the Database. it is because the new combination of key fields is unique.

i tried using update statement . Update is not working as the combination key is creating a new record which is not present in Db and hence , its not updating.

do we have any workaround on this ??

if i update the key field same field should be updated with other fields intact

please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
900

key field means unique record.

if u try to change a key field it will add a new entry.

to an existing entry with a key combination u can change only the non-key fields.

else u need to delete the record combination and add the new combination.

5 REPLIES 5
Read only

Former Member
0 Likes
900

Hi Pratyush,

In this case UPDATE key word works. You must be passing wrong parameters.

Just check your code once again.

Regards,

Atish

Read only

0 Likes
900

hi,

correct me if i'm wrong.

Update keyword works for existing records in the DB table? if after changing the record , the comdination of key fields are already present in the DB, then it will update or else it won't update.(sy-subrc = 4).

Read only

0 Likes
900

Yes. Your understanding is correct.

Regards,

Atish

Read only

0 Likes
900

hi,

thanks for all your replies.

Read only

Former Member
0 Likes
901

key field means unique record.

if u try to change a key field it will add a new entry.

to an existing entry with a key combination u can change only the non-key fields.

else u need to delete the record combination and add the new combination.