Supported by
Supported by Inetum

DELETE vs CLEAR vs REFRESH vs FREE

images/thumbnail.jpg - Thumbnail

DELETE CLEAR REFRESH FREE

These are different ways of deleting all data from an internal table. They look the same. But they aren’t.

The following image shows the memory analysis of 4 internal tables with the exact same data. Their names are suggestive of what will happen to them. If you don’t get it call a friend who doesn’t know ABAP and ask for help:

delete_refresh_clear_free_antes

Now look at the result after each of the above commands were applied:

delete_refresh_clear_free_depois

As you can see, only FREE got rid of the whole allocated memory. CLEAR and REFRESH still managed to release a good part of it. But DELETE didn’t even try.

Judging by this, it looks like FREE is the one to choose when you want to get rid of an internal table’s data, at least in the cases where you won’t be needing it again.

Thank you Fábio Branquinho for the tip.

Thank you Aaron Webb for the photo.

Greetings from Abapinho.