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

Main diff b/w free and refresh

Former Member
0 Likes
1,048

main diff b/w these two

what happends after declaring internal table liske this

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,010

Hi,

free itab

will remove the memory allocated and you cannot use it after this statement

refresh itab

clears off the data in the table and it that table can be used after this statement

if you want to reuse the itab for differnent records with the same field

then go for refresh

if you dont want the itab after certain operations

go for free

thanks & regards,

Venkatesh

main diff b/w these two

what happends after declaring internal table liske this

7 REPLIES 7
Read only

Former Member
0 Likes
1,010

Free is to free the grid/alv container/memory ID.

For internal table, you need to use REFRESH.

FOr workareas/structure/variables use CLEAR

Read only

Former Member
0 Likes
1,010

Hi,

Free : It clears the contents of the internal table and deallocated the memory assoxiated with it.

Refresh : It just clears the body of the internal table, doesnt deallocate menory space.

regards,

Navneeth K.

Read only

Former Member
0 Likes
1,011

Hi,

free itab

will remove the memory allocated and you cannot use it after this statement

refresh itab

clears off the data in the table and it that table can be used after this statement

if you want to reuse the itab for differnent records with the same field

then go for refresh

if you dont want the itab after certain operations

go for free

thanks & regards,

Venkatesh

Read only

gopi_narendra
Active Contributor
0 Likes
1,010

Free is used to clear all the memory values

Reset to appropriate initial value for type, including release of resources

- FREE f.

Release an area in the ABAP/4 memory

- FREE MEMORY.

Release the memory occupied by an external object

- FREE OBJECT obj.

Refresh is used to clear all the internal table contents.

refresh it_tab.

Regards

Gopi

Read only

Former Member
0 Likes
1,010

HI,

refresh and free both we will use for clearing the internal table body.

but,refresh will initialize the internal table memory.

if it is occurs 0 it will be initialized to 8kbs,if it is occurs n it will initialize for n records.

<b>reward if helpful</b>

rgds,

bharat.

Read only

Former Member
0 Likes
1,010

Hi N Naresh

normally when you declare the variable . variable will occupy the space for the data .

FREE and REFRESH is used for clearing the data in variable , though the entire memory area occupied by the table rows is released.

Best Regards

Wiboon

Read only

Former Member
0 Likes
1,010

Hi Naresh,

FREE : This statement deallocates the memory of the runtime object.. suppose that you say FREE itab, it will deallocate the memory allocated to this internal table at runtime..

What happens is, at the time of execution, when the first record is appended to the internal table, the system allocates a memory block for this table depending on the number in the OCCURS statement if any..

Now, when you use the FREE statement, the system deallocates this memory block..

REFRESH : This statement clear the contents of the internal table, but does not deallocate the memory space..

Use:

FREE : In your program logic, when you are sure that a particular internal table is not going to be used after a certain point, then use FREE.

REFRESH : When you want to clear the contents, but are going to populate the table with new data again, then use REFRESH.

If you use FREE for table clearing, it makes bad impact on performance, because the system spends extra time in the allocation and deallocation of memory.

Thanks and Best Regards,

Vikas Bittera.