Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Avoiding UPDATE statement inside the LOOP.


My requiremnt is to update records in a Z-table for all the records in an internal table.For each record update failure , I need to display in the output.

So instead of using the LOOP statement , I was thinking of Creating a Function Module to avoid an UPDATE statement inside the loop. This FM would be called in the program.

The Importing parameter of the FM would be a internal table containing records that needs to be updated in the database table. The exporting parameter would be a Error Log table .

In the FM I would read the importing table from index 1 and use the UPDATE statement to directly update the Ztable.

If an error was found then update the Error Log table.

Which one is better in terms of performance.

1. Using a LOOP statement and using an UPDATE statement inside the LOOP.

2. Using the FM module LOGIC mentioned above.



Former Member

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question