How to delete the actives while running a loop in the internal table?

SAPABAP

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 the 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 simple use

“DELETE lt_itab”

One more thing if you are using the 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.


raja
Published on 08-Feb-2018 15:09:57
Advertisements