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: 

What is meaning of Initial Size 0 in internal table ?

Former Member
0 Kudos

Hi SAP-ABAP Experts .

I have created a internal table like this

i am not understanding the role of Initial Size key word .

What is meaning of Initial Size 0 ?

If do not give this then it (Internal tabe)also works same way ?

TYPES: BEGIN OF t_ekko,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

statu TYPE ekpo-statu,

END OF t_ekko.

DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,

PLease explain it .

Best regards : rajneesh

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Check this extract from SAP Help


Initial Memory Requirement

You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following addition: 

INITIAL SIZE <n>

This size does not belong to the data type of the internal table, and does not affect the type check. You can use the above addition to reserve memory space for <n> table lines when you declare the table object. 

When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated. 

You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= <n> <= 100.

It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example). 

To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB.

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm

5 REPLIES 5

Former Member
0 Kudos

Hi,

When u give 0 some default memory(8 bytes) will be allocated

regards,

lavanya

0 Kudos

Initial Size 0 will always allocate 8 Kb of memory area to the internal table. Further memory allocations will be dynamic i.e. as you add entries into internal table system will assign next blocks in chunks of 12kb each.

Initial size 10 will allocate the memory depending on the line wodth of your internal table . If your table line

Is 80 Bytes Long - Intial Memory allocated would be

8 kb as ( 80 X 10 = 800 b is less than 8 Kb and system will not allocate less than 8 kb. )

Is 900 bytes long then Initial memory allocation would be 20 kb ( 900 X 10 = 9000 Bytes , is greater than 8 kb so the next block of memory is released ).

In nutshell occurs or initial size only affect the initial memory space allocation of int. table. All subsequent memory blocks are 12 Kb.

For custom programs occurs 0 or initial size 0 is good as system will take care of memory allocation. In any case you can only change the initial memory allocation by these two key words.

Former Member
0 Kudos

The INITIAL SIZE sets the expected number of entries for this internal table.

When the program is processed, memory is allocated for the table when it is created.

You can also omit this statement and just use TYPE TABLE OF.

Former Member
0 Kudos

The optional INITIAL SIZE addition allows you to specify how much memory should be allocated to the table when you create it. This corresponds to the OCCURS specification in variant 2 (see also Performance Notes for Internal Tables). The value n is not taken into consideration in the type check.

Former Member
0 Kudos

Check this extract from SAP Help


Initial Memory Requirement

You can specify the initial amount of main memory assigned to an internal table object when you define the data type using the following addition: 

INITIAL SIZE <n>

This size does not belong to the data type of the internal table, and does not affect the type check. You can use the above addition to reserve memory space for <n> table lines when you declare the table object. 

When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated. 

You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= <n> <= 100.

It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example). 

To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB.

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm