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.
Showing results for 
Search instead for 
Did you mean: 

occurs 0

Former Member
0 Kudos

when can we use occurs0? if we use occurs 0 how will the memory be allocated?

can anyone explain it pls?


Active Participant
0 Kudos

OCCURS n is obsolete in OO Context and it is advisable to use INITIAL SIZE instead. The difference between the two is that OCCURS n allocates memory to store specified number of rows in the internal table and also creates a header line, whereas INITIAL SIZE allocates memory for the specified number of rows without creating the header line.

Reward if helpful,



Former Member
0 Kudos


Occurs 0 will allocate one record of memeory as and when the first record in appended or inserted to the table. BY default no space wil be reserved at the beginnig..

Occurs1 will reserve space for the first record from the beginning itself. From there on, there is no much difference


<b>Reward points</b>


Active Contributor
0 Kudos

Occurs 0 will allocate the memory on need basis ,as and when it encounters the append statement.

Initially no memory will be allocated.

if it comes across an append statement, it will allocate space for one record.

It will continue to do that until the last append statement.



Former Member
0 Kudos


Occurs 0 ---> By default No Memory Allocation to the Itab. The Allocation will be Dynamically done at Run time.

Occurs N ---> By Default it will be allocated of Size N. this is not Good Practice in case of performance.

for Better Performance Use Occurs 0.



Former Member
0 Kudos


Besides declaring the structure of an internal table, the OCCURS clause also defines how many table entries are maintained in main storage. Extra records are written out to paging area and can effect performance.

<b>beside this u can go thru following links</b>

<b>Rewards if helpful.</b>


Former Member
0 Kudos

occurs 0, the memory allocation is done by system,

in case of occurs 100 memory of 100 records allocated initially ,then if records exceeds then system ll allocate memory,

memory allocation here is known as extent and depend upon basis administrator...

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

OCCURS 0 is betten than OCCURS 100 because



if you use occurs 100, the ABAP memory will allocate for 100 records memory location, some time you have only 20 records at that time the remaining 80 records memory space will waste.



In bus total seat is 57, some time only 20 people only will come at that time also bus should go so remaining seats will waste.



OCCURS 0, the memory is not allocated previously, that is optimistic.if you have 20 records the memory will take for only 20 records.



<b>*reward for useful answers*</b>

Former Member
0 Kudos


OCCURS 0 is use when u defined any internal table. Initialy it is not allocating any memory. But at the run time depending upon the data it is allocating memory.

if you define OCCURs 10 then it will allocate the memory for 10 records.

So better to use OCCURS 0 then predefining its records size.

<b>Rewards if useful.</b>



Former Member
0 Kudos

Occurs 0 can be used when you do not know exact amount memory that would be consumed do not wish to use more memory than needed.

When you use occurs 0, the memory will be alloted as and when you give data.

So if there is little data you can avoid wastage of memory by using occurs 0.

Former Member
0 Kudos

Hi pandurangarao,

1. when can we use occurs0?

When declaring internal tables,

whose expected number of records we are not sure,

or we are not bothered.

Its normally better to use occurs 0,

rather than occur 10 , 100 , 90 etc.

2. if we use occurs 0 how will the memory be allocated?

a. if we use 0, 10 , or any other figure,

there is no restriction on the expansion of the internal table.

the 0, 10, etc is just a indicative figure for expected number of records.

b. When using 0,

<b>8 KB</b> - the internal table will be expanded in bunches of 8 KB.


amit m.

Former Member
0 Kudos


The main difference to use OCCURS 0 is, it is optimistic, because need not allocate memory space,it will allocate memory space at the run time,



OCCURS 100 means the program allocate 100 records memory space, if we have only 50 records, at that time the remaining 50 records memory space will waste, best example is BUS.

This kind of problem will not come in OCCURS 0.


Former Member
0 Kudos

thank u