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

Small Doubt in Internal Table

Former Member
0 Likes
1,048

Hi Friends,

Consider an internal table having 10 records in it.Then, I'm deleting 3 Records in it.

My doubt is

  • Initially for 10 Records ,Internal Table would

have allocated some space for that record.

  • When I deleted 3 Records ,whether the memory

space for 3 records will be deleted or only the

records is deleted.

  • If so, how to delete the memory space for the 3

records.Is there any special command for

deleting the memory space.

  • This Scenario is only for ABAP not for

ABAP objects.

with Regards,

Kumaresh.T

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,019

Hello Kumar,

The memory allocation depends on how u r declaring the internal table with occurs additoion.

If u declare it with Occurs 10, then intially the momory allacated will be for 10 records, if the number of records exceeded above 10 records then the memory will be extended to accomadate 10 more records even though the itab has 3 records.

Similarly when u delete the 3 records from the Itab, the memory will not be reassigned.

Reward if helps.

Vasanth

Hi Friends,

Consider an internal table having 10 records in it.Then, I'm deleting 3 Records in it.

My doubt is

  • Initially for 10 Records ,Internal Table would

have allocated some space for that record.

  • When I deleted 3 Records ,whether the memory

space for 3 records will be deleted or only the

records is deleted.

  • If so, how to delete the memory space for the 3

records.Is there any special command for

deleting the memory space.

  • This Scenario is only for ABAP not for

ABAP objects.

with Regards,

Kumaresh.T

8 REPLIES 8
Read only

Former Member
0 Likes
1,020

Hello Kumar,

The memory allocation depends on how u r declaring the internal table with occurs additoion.

If u declare it with Occurs 10, then intially the momory allacated will be for 10 records, if the number of records exceeded above 10 records then the memory will be extended to accomadate 10 more records even though the itab has 3 records.

Similarly when u delete the 3 records from the Itab, the memory will not be reassigned.

Reward if helps.

Vasanth

Read only

Former Member
0 Likes
1,019

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.

Note

Performance:

The runtime required to reset an internal table and free its resources, bound by the data object f, depends how much memory the internal table has been occupying.

To reset a small internal table takes around 80 msn (standard microseconds), a 200 KB table takes around 700 msn, and a 1 MB table around 3500 msn.

If the table has an index or hash table (because it was created using INSERT, DELETE or SORT, or edited using COLLECT), the runtime increases, since the index or hash table also need to be released.

Read only

hymavathi_oruganti
Active Contributor
0 Likes
1,019

occurs clause use is to allocate memory dynamically.

so, it handles it i suppose.

Read only

Former Member
0 Likes
1,019

Hi Kumaresh,

How have u declared ur internal table , if u had declared it with occurs 0 , then i think how many records are that much space only will be available

Read only

Former Member
0 Likes
1,019

Hi,

If you are declaring the Internal table with additional parameter OCCURS <value> then the memory space is allocated. even if you delete records the memory space still remains.

If you are not using OCCURS addition then memory space will be freed automatically.

Hope it solves your problem.

Regards

Ankit

Read only

0 Likes
1,019

Hi,

There are two commands which you may have used.

REFRESH and FREE.

if you use refresh then it will clear the table means will delete the records without de-allocating memory.

If you are using FREE it will de-allocate the additinal memory.

The other answers are enough to get the importance of OCCURS.

Regards,

Jignesh

Read only

Former Member
0 Likes
1,019

hi,

we have,

1.Clear ITAB.

2.Refresh ITAB.

3.Free ITAB.

4.Delete ITAB.

in all these,Free ITAB will removes the contents from the internal tables body & deallocates the memory of the internal table,

check it out,

kcc

Read only

Manohar2u
Active Contributor
0 Likes
1,019

After you delete the record from internal table, the memory will get released.

You can moniter the memory of internal table while in debug mode from menu goto- status display-memory use.

http://help.sap.com/saphelp_nw2004s/helpdata/en/c6/617cf4e68c11d2b2ab080009b43351/content.htm

Regds

Manohar