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

redarding internal tables

Former Member
0 Likes
1,108

hi,

As per my knowledge during the defination internal table donot allocate memory but we use 'free' to deallocate the memory associated with internal tables...

how is it possible...

thanks.

Saurabh Agrawal.

10 REPLIES 10
Read only

Former Member
0 Likes
1,078

Saurabh,

FREE statement is used for deleting the internal table and releases the memory.

So it's not only releases the momory it's deleting the defination for internal table also.

Regards,

Amey

Read only

Former Member
0 Likes
1,078

Hi saurabh,

once memory is allocated to an internal table by using occurs ... ,then to deallocate that memory free will be opted.

Read only

Former Member
0 Likes
1,078

Hi,

Whenever you create the internal table irrespective of which statement you use to define it, memory is allocated to the internal table.

To explicitly allocate memory to the internal table you use the 'OCCURS' statement.

After the use of the internal table is over you can then allow this memory to be freed for other use by using the 'FREE' statement.

Hope this clarifies your question.

Read only

Former Member
0 Likes
1,078

Hi ,

FREE statement will free the memory allocated to the internal table while creating it..

To my knowlege OCCURS 0 will allocate a memory of 8 KB to the internal table...

Is it like , if i declare OCCURS 100 , will allocate 800 KB..

Plz anyone clarify this, or can add few more info...

Thanks

Rajiv

Read only

Former Member
0 Likes
1,078

Hi,

Free will deallocate the memory of the internal table and even the size of the internal table will decrease.

Regards,

Gunasree.

Read only

Former Member
0 Likes
1,078

Hi Saurabh Agrawal

u can refer to this link

http://www.allsaplinks.com/internal_tables_all.html

Read only

Former Member
0 Likes
1,078

we r not allocating memory seperately but while declaring internal table we use occurs statement it will automatically allocate memory and we use free to deallocate memory.

Read only

Former Member
0 Likes
1,078

HI saurabh,

<b>Here I will give you a clear information about your query.</b>

See for example we take some scenario of using internal tables

we are using an <b>internal tables itab1 , itab2</b> fetching data into these tables by some select statements so depending on the number of records <b>memory is allocated</b> to these two table--- right....

now you have another <b>internal table IT_FINAL</b> with sould be the output of your report.

looping the itab1 and reading itab2 you get data into the it_final internal table

and show the output using alv grid....

After you get data into final internal table and displaying it, then you can free the itab1 and itab2 .. memory aloocated to ITAB1 AND ITAB2 is dealocated now..

Hope you are clear now

rewards if understood

regards,

nazeer

Read only

Former Member
0 Likes
1,078

Hi saurabh,

when u will define an internal table with occurs 0 it will allocate a memory size of 8Kb to that internal table intially...

the FREE command is used to freeze the body of the internal table...

FREE itab.

aftre this command the internal table will be having only the header part it won't be having the body...use the FREE command when u have finished using that internal table...

alternative to FREE is the REFRESH command..this will clear only the header of that internal table...where as the body size remain as it is...

hope this would solve ur problem....

Regards,

Prashant

Read only

Former Member
0 Likes
1,078

Hi Saurabh

While definition of internal table ,if you use "DATA" in the declaration then memory will be allocated automatically...

after display of internal table to deallocate that memory we use "FREE ITAB".

Data : Begin of itab_final occurs 0, //here memory gets allocated

matnr like mara-matnr,

werks like marc-werks,

end of itab_final.

REWARD IT PLEASE....!!!