My 2 cents to Ricardo's answer:
At the inner loop, I would not do a WHERE. Just loop from SY-TABIX and delete while the key matches, else EXIT. It is my understanding that the WHERE still checks the subsequent entries in case one may match (it does not necessarily use a sorted table). Since you sorted explicitly, you know you can exit upon the first mismatch and skip that.