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: 

DIff btn occurs 0 and occurs n

Former Member
0 Kudos

hi all,

DIff btn occurs 0 and occurs n,

how memory is allocated for these and which one is good in terms of performance

Thanks

SAI

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hai

Occurs 0 : performance factor.

By default internal table created is without

header line.

the memory allocating for 0 records

Occurs n : memory allocation for n records

if the database table having n-1 records then the system loss some memory

Thanks & regards

Sreeni

5 REPLIES 5

Former Member
0 Kudos

Hai

Occurs 0 : performance factor.

By default internal table created is without

header line.

the memory allocating for 0 records

Occurs n : memory allocation for n records

if the database table having n-1 records then the system loss some memory

Thanks & regards

Sreeni

0 Kudos

The number <N> indicate how many lines has to have the table in initialization time: i.e. when the program is loaded in memory, the space for the table depends on the initialization numbers of the records.

AT run time if the table needs more space, this'll automatically be enhanced.

But If you know your table can have a certain numbers of records, you can indicate it in the defination, what'll improve the performance:

all the space the table needs is taken at the beginin, so it doesn't need to enhance the space at run time.

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

Former Member
0 Kudos

HI

GOOD

THERE IS NO SUCH BIG DIFFERENCE BETWEEN OCCURS 0 AND OCCURS N

WHEATHERE YOU DECLARE A INTERNAL TABLE WITH OCCURS 0 OR OCCURS N IT TAKING 186MB OF MEMORY,SO IF YOUR DATA IS EXCEEDING MORE THAN OCCURS N THAN IT WILL GIVE YOU ERROR,SO WE USE TO DECLARE OCCURS N BECAUSE WE GENERALLY DOESN'T KNOW WHAT AMOUNT OF DATA IS COMING FROM THE DATABASE.

THANKS

MRUTYUN

former_member188685
Active Contributor
0 Kudos

Hi,

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.

Regards

vijay

Former Member
0 Kudos

Hi,

This same question was discussed a few days back in SDN. PLease refer teh below link:

Please reward helpful answers

Regards,

Anjali