Is it possible to delete the actives while you are running a loop over an internal table in SAP ABAP?

SAP HANASAPSAP Basis

DELETE command will have a result. You should make sure that once you delete the row, there should not be any reference or use of row subsequently in the loop. The best is to use CONTINUE as soon as you perform deletion.

I will suggest avoiding “DELETE lt_itab INDEX sy-tabix” because it will change the sy-tabix i.e. table index. In case if you just want to delete the current row in the loop then you can simply use.

“DELETE lt_itab”

One more thing if you are using statement “DELETE lt_itab FROM ls_wa” then whether knowingly or unknowingly, you are deleting the same lines from the internal table.

Overall If I sum up it in one line, if you are updating or modifying the table over which you are currently running a loop, then better be sure of what you are doing.

Published on 12-Dec-2017 06:21:51