cancel
Showing results for 
Search instead for 
Did you mean: 

UPDATE statement delete rows

Cem22
Newcomer
0 Kudos
158

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

raymond_giuseppi
Active Contributor
0 Kudos

Update will not delete a record, do you clear (or forget) other fields, what's your exact code?

View Entire Topic
jakob_steen-petersen
Active Participant
0 Kudos

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...