"
Supported by

DELETE vs CLEAR vs REFRESH vs FREE

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.

2 comentários a “DELETE vs CLEAR vs REFRESH vs FREE”

  1. Junior Vieira Diz:

    Sempre achei que o comando REFRESH era a melhor solução.
    Vou rever meus conceitos, e começar a utilizar o FREE.

    Abcs

  2. Adriano Campanhola Diz:

    Segundo a documentação da SAP, nas versões mais novas o comando REFRESH é obsoleto e deve ser substituido pelo FREE

Deixe um comentário


About Abapinho
Abapinho runs on WordPress
Articles (RSS) e Comments (RSS).