ABAP Obsolete - Refresh
The refresh function has been obsolete for quite some time, which function is actually helpfull? Refresh, Clear or Free, what do you need when?
The Refresh function has been obsolete for a while now and is no longer needed because CLEAR and FREE are already available, which can do the same as REFRESH.
"But Refresh deletes the table body with a header line," you might think. That's right, but you do not need the refresh, because the Clear can do the same, if you pay attention to what you want to delete. As an example, how it was done so far:
" Clear a Select-Option REFRESH: s_bukrs. CLEAR: s_bukrs.
Now you can map both lines within one line and the Clear statement:
" Clear a Select-Option CLEAR: s_bukrs, s_bukrs.
For the specification of the table body, the square brackets  are used, which refer to the table. If you omit this, you will refer to the header. Normal tables without header lines require no special handling for this processing and can still use them as before.
Hint: In addition, you should note that the use of tables with header lines is much longer obsolete and this is already prohibited in classes. Select-options and old reports are the only exception to using tables with header lines, which you should edit with structures instead of using the header line.
What does the function FREE do? This works on tables as well as refresh, except that it frees the previously set memory by the internal table and the data. With a Clear, only the table lines are deleted, memory occupied by the table is not released.
This may be of great interest if you continue working with the same table in the program and need to keep much data. If you also keep many large tables in the report, you could run out of memory.
Clear vs Free
A small report with an example of how the commands work. The report creates two internal tables that are based on table T001 (company code basic data). This should be an example of a bigger structure.
REPORT ztest_clear_vs_free. DATA: lt_tclr TYPE STANDARD TABLE OF t001, lt_tfre TYPE STANDARD TABLE OF t001. " Fill tables DO 100000 TIMES. APPEND VALUE #( butxt = sy-index ) TO lt_tclr. APPEND VALUE #( butxt = sy-index ) TO lt_tfre. ENDDO. " Clear tables CLEAR lt_tclr. FREE lt_tfre.
At the beginning both tables are empty ...
... after the first loop they contain the first lines and allocate memory ...
... at the end the table is completely filled ...
... but the real difference becomes obvious after deleting the table content ...
The entire reserved memory of the table was released with Free, the table has the status before filling. Clear has also cleared the rows, but the memory reserved by the rows is still blocked as long as the variable exists.
The memory allocation can be found in the debugger under the variable display under a separate tab.
These are so far but only theoretical constructs and applicable only for a few productive reports. Experience shows that the use of Clear is completely sufficient and you no longer need other statements for daily use. Our recommendation is therefore clear to use CLEAR.