- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to delete the actives while running a loop in the internal table?
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
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.
- Related Articles
- Is it possible to delete the actives while you are running a loop over an internal table in SAP ABAP?
- How to convert a Python for loop to while loop?
- The internal working of the ‘foreach’ loop in PHP
- How to emulate a do-while loop in Python?
- How to use ‘while loop’ in Java?
- What are the differences between while loop and do-while loop in Java?
- How to write a while loop in a JSP page?
- Python - How to convert this while loop to for loop?
- How to delete all the duplicate records in a MySQL table?
- do…while loop vs. while loop in C/C++
- How to use PowerShell Break statement with the While Loop?
- How to use ‘do while loop’ in Java?