Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

hi gurus what is the diff between free & refresh

Former Member
0 Kudos

hi gurus what is the diff between free & refresh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Free will free the memeory allocated to your internal table where as refresh will delete the contents/records of your internal table.

Please Reward to all helpful answers.

Regards,

Lalit

9 REPLIES 9

Former Member
0 Kudos

Hi

Free - You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

Refresh - This always applies to the body of the table. As with the CLEAR statement, the memory used by the table before you initialized it remains allocated. To release the memory space, use the statement

Regards

Divya

Former Member
0 Kudos

Hi,

Free will free the memeory allocated to your internal table where as refresh will delete the contents/records of your internal table.

Please Reward to all helpful answers.

Regards,

Lalit

Former Member
0 Kudos

Hi,

Free:

The FREE statement has the same effect as the CLEAR

statement for any data objects except internal tables.

For internal tables, FREE has the same effect as the REFRESH statement. It releases the entire memory area occupied by the table rows. If dobj is a structure with table-like components, the memory of each table-like component is released.

Refresh:

This statement sets an internal table itab to its initial value, meaning that it deletes all rows of the internal table. The memory space required for the table is freed up to the initial memory size INITIAL SIZE. For itab, you must specify an internal table.

To delete all rows and free the entire memory space occupied by rows, you can use the statement FREE.

Former Member
0 Kudos

Hii!

FREE f.

Effect

FREE f has the same effect as CLEAR f , namely that a Data object f is reset to the initial value corresponding to its type.

Unlike CLEAR, FREE also releases any resources taken up by the data object f. FREE can also release more resources than CLEAR for table work areas declared using the TABLES statement.

After FREE f, the data object f can be re-addressed at any time. The only condition is that you may need to re-allocate resources to the object.

Note

If f is an internal table with header line (where the name f in a sense has two meanings) the statement FREE f refers to the body of the table, and the statement CLEAR f refers to the header line.

REFRESH itab.

Effect

The internal table itab is reset to its initial state, i.e. all table entries are deleted.

Der Return Code SY-SUBRC is undefined.

Notes

The header entry of a table with a header line remains unchanged. It can be reset to its initial value using CLEAR.

FREE itab can be used to free up the memory allocated to the table.

Note

Performance:

The runtime required to reset an internal table depends on the amount of memory previously occupied by that table.

Resetting a small internal table takes around 15 msn (standard microseconds). Resetting a 200 KB table takes around 400 msn, and a 1 MB table, around 3000 msn.

If the internal table has an index or a hash table (because it was edited using INSERT, DELETE, SORT or COLLECT), the runtime increases slightly, since the index or hash table has to be released as well as the table itself.

Regards

Abhijeet

Former Member
0 Kudos

Hi,

FREE :

The FREE statement has the same effect as the CLEAR

statement for any data objects except internal tables.

The initial values are assigned to elementary data types according to the table of built-in ABAP types.

Reference variables are assigned null references.

Structures are set to their initial values component by component.

For internal table , all rows in an internal table are deleted. All the memory required for the table, except for the initial memory requirement, is released. The FREE statement is used to release the memory space occupied by the rows of internal tables.

For internal tables, FREE has the same effect as the REFRESH statement, though the entire memory area occupied by the table rows is released, and the initial memory area remains unoccupied. If dobj is a structure with table-like components, the memory of each table-like component is released.

REFRESH :

This statement sets an internal table itab to its initial value, meaning that it deletes all rows of the internal table. The memory space required for the table is freed up to the initial memory size INITIAL SIZE.

To delete all rows and free the entire memory space occupied by rows, you can use the statement FREE.

The statement REFRESH itab acts for all internal tables like CLEAR itab[]. If an internal table itab has a header line, then the table body and not the header line is initialized. If the internal table itab has no header line, REFRESH itab acts like CLEAR itab. Therefore, you should always use CLEAR instead of REFRESH.

Hope this clarifies your doubt.

plz reward if useful.

thanks,

dhanashri.

Former Member
0 Kudos

Hi vasu,

Free - You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

Refresh - This always applies to the body of the table. As with the CLEAR statement, the memory used by the table before you initialized it remains allocated. To release the memory space, use the statement

Regards,

Sravanthi

Former Member
0 Kudos

Vasu,

When you ask any question then once you get the answer to your question, kindly close the thread and reward all useful answers.

Regards,

Lalit

Former Member
0 Kudos

HI,

Refresh itab.

This statement 'Refresh' sets an internal table itab to its initial value, meaning that it deletes all rows of the internal table. The memory space required for the table is freed up to the initial memory size INITIAL SIZE.

FREE dobj.

The FREE statement has the same effect as the CLEAR

statement for any data objects except internal tables.

For internal tables, FREE has the same effect as the REFRESH statement. It releases the entire memory area occupied by the table rows. If dobj is a structure with table-like components, the memory of each table-like component is released.

bpawanchand
Active Contributor
0 Kudos

HI

Free - You can use FREE to initialize an internal table and release its memory space without first using the REFRESH or CLEAR statement. Like REFRESH, FREE works on the table body, not on the table work area. After a FREE statement, you can address the internal table again. It still occupies the amount of memory required for its header (currently 256 bytes). When you refill the table, the system has to allocate new memory space to the lines.

Refresh - This always applies to the body of the table. As with the CLEAR statement, the memory used by the table before you initialized it remains allocated. To release the memory space, use the statement

Regards

Pavan