cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

UPDATE statement delete rows

Cem22
Newcomer
0 Likes
622

Hello,

I'm a beginner in ABAP and I'm facing an issue while working with a copy of the SBOOK table. We've created a new table by copying SBOOK, but when I try to update a record to change the passenger name by using UPDATE statement the entire row gets deleted instead of just updating the field.

Could anyone help me understand why this might be happening and how to resolve it.

Thanks in advance. 

Kind Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

jakob_steen-petersen
Contributor
0 Likes

You need the full row as it was before in your Work Area (the variabel structure you are updating from). Like this where data is read into Work Area before updating:

DATA wa TYPE scustom.
SELECT SINGLE *
       FROM scustom
       WHERE id = '00017777'
       INTO @wa.
wa-discount = '003'.
UPDATE scustom FROM @wa.

Otherwise you need to update specific field with this:

UPDATE <table> set <FIELDNAME> = 'xxx'
where key1 eq xxx
and    key2 eq yyy...