Application Development and Automation 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: 
Read only

Internal tables

Former Member
0 Likes
922

Can any one tell me the difference between free,refresh and clear internal tables

9 REPLIES 9
Read only

Manohar2u
Active Contributor
Read only

Former Member
0 Likes
899

Hi

FREE

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, 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.

If dobj is an internal table with a header line, FREE has the same effect as REFRESH on the table body, and not the header line.

REFRESH itab.

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.

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.

CLEAR dobj [ {WITH val [IN {BYTE|CHARACTER} MODE] }

| {WITH NULL} ].

1. ... WITH val [IN {BYTE|CHARACTER} MODE]

2. ... WITH NULL

Without the optional additions, the data object dobj is assigned the type-specific initial value. The following applies:

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.

All rows in an internal table are deleted. All the memory required for the table, except for the initial memory requirement, is released (see Declaring Internal Tables). The FREE statement is used to release the memory space occupied by the rows of internal tables.

The optional additions allow you to fill the spaces of a data object with other values than the initial value.

If dobj is an internal table with a header line, you must specify dobj[] to delete the rows, otherwise only the header line will be deleted.

Reward if useful

REgards,

Sangeetha.A

Read only

Former Member
0 Likes
899

When <b>CLEAR</b> references an internal table itab with a header line, it only resets the sub-fields in the header entry to their initial values

<b>REFRESH itab.</b>

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

The header entry of a table with a header line remains unchanged

<b>FREE itab.</b>

Releases the memory space needed to process the internal table itab .

The runtime needed to execute the FREE statement is approx. 5 msn (standardized microseconds).

Read only

Former Member
0 Likes
899

Hi,

<b>CLEAR itab.</b>

The memory space required for the table is released, except for the initial memory requirement.

If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table itself, not the header line, during initialization using CLEAR, you must place two square brackets ([]) after the table name.

<b>CLEAR itab[].</b>

To ensure that the table itself has been initialized, you can use the statement

<b>REFRESH itab.</b>

This always applies to the body of the table. With REFRESH, too, the initial memory requirement fort he table remains reserved. To release this memory space, use the statement

<b>

FREE itab.</b>

You can use FREE to directly initialize an internal table and to release its entire memory space, including the initial memory requirement, without first using the REFRESH or CLEAR statements. Like REFRESH, FREEaccesses the table body, not the table work area. After a FREEstatement, the internal table still exists. 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.

Regards

Sudheer

Read only

Former Member
0 Likes
899

Hello,

<b>REFRESH</b> -- The internal table itab is reset to its initial state, i.e. all table entries are deleted.

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

<b>FREE</b> itab can be used to free up the memory allocated to the table.

Regards,

Lijo

Read only

Former Member
0 Likes
899

hi,

free - if we use free itab then it releases memory occupied .

clear - clear itab will clear the workarea used .

refresh - refresh itab will clear the values in internal tables without releasing memory..

Reward with points if helpful.

Read only

Former Member
0 Likes
899

hi

good

these are the commands used with respect to Internal Tables

CLEAR: clears the header line of the internal table

REFRESH: deletes the body of the internal tables ( removes data )

FREE: removes the internal table from the memory by deleting data and everything.

thanks

mrutyun^

Read only

sivaprasad_ml
Participant
0 Likes
899

Dear Mahesh,

1. Free deletes the entire content of internal table and frees the memory.

2. Refresh clears the body of internal table.

3. Clear clears the header data of the specified table.

Regards

Siva

Read only

Former Member
0 Likes
899

Hi,

In simple terms below is the information :

Free : It will deallocate the memory assigned to the internal table.

Refresh : It will completely delete the data from the internal table.

Clear : It will delete the data in the header line of internal table.

Thanks,

Sriram Ponna.