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: 

UPDATE...SET syntax to update db table from import parameter.

0 Kudos
369

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

Sandra_Rossi
Active Contributor
0 Kudos
300

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)