Generally CLEAR or REFRESH statement is used to release the allocated memory for internal tables. Now think of a situation where an internal table initially contains a huge volume of records so as the huge allocated memory. Now you deleted [ DELETE statement doesn’t release memory as CLEAR or REFRESH statement does ] most of the records from the internal table as per needed but what about the large allocated memory to the table.
In such a case below process can be used for efficient use of memory.
Lets execute the below report with break point set up to analyse the memory.
Execute the select statement and in the debugger select the ‘Memory Analysis’ tab and put LT1 and LT2. Observe the allocated memory for LT1 table.
Now execute the delete statement which deletes most of the records form table LT1. Now still the allocated memory for the table is not decreased.
Now execute the APPEND LINES OF LT1 TO LT1. statement. And observe the allocated memory for the table LT2 which is much more less than the allocated memory of the table LT1.
Now we can refresh the table LT1 and assign back the records of LT2 to LT1 and continue.