2021 Feb 02 2:07 PM
So i want to update the fields on a db table, given a key. The code i'm showing works, it gets updated, but the issue is i don't want to do it inside a loop. Is there a more optimal way to do this without a loop?
I was thinking of using modify, maybe with transporting, but as you can see i'm taking just one field from the import parameter - "answer". What could be done this to improve the performance? Also - i'm sure that all of the i_tab records already exist in the db table and that there are no dublicate records or things like that. I'm not adding new records, i'm just updating existing ones.
LOOP AT i_tab INTO DATA(temp).
UPDATE zrs_dataclear SET status = 90
answer = temp-answer
answer_date = sy-datum
answer_time = sy-timlo
uname = sy-uname
WHERE errornr = temp-errornr.
ENDLOOP.
2021 Feb 02 2:26 PM
To "improve the performance", BUT did you experience any performance issue?
See ABAP documentation of UPDATE -> UPDATE ... FROM TABLE ...
(note that UPDATE ... FROM TABLE ... may be converted into several UPDATE statements by the DBI/kernel so you won't see any performance improvement)