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

Internal Table ????

Former Member
0 Likes
515

Hi Experts,

While creating an internal table, we mention occurs 0 or occurs 1. what is the difference between occurs 0 and occurs 1. which is better?what happens if we give occurs 0?

Thanks in acvance,

Ramana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
487

The number 0 or 1 is a indicator to the system about the approximate number of rows that will be appended to the internal table.

It really doesn't matter much whether you give 0 or 1.

With the latest syntax, the OCCURS clause has been removed.

Regards,

Ravi

Note - Please mark all the helpful answers

5 REPLIES 5
Read only

Former Member
0 Likes
488

The number 0 or 1 is a indicator to the system about the approximate number of rows that will be appended to the internal table.

It really doesn't matter much whether you give 0 or 1.

With the latest syntax, the OCCURS clause has been removed.

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

Former Member
0 Likes
487

Hello Venkata,

When u declare an internal table as occurs 1 it allocates a memory exactly as req by 1 record and with addition of any new entries it gets extended. However when u declare as 0 memory is not allocated by done at runtime.

When u are using internal table to load fixed entires then u should declare the table with specific names. e.g if u reading entries from material type and u know there will be only 5 entries then u should declare the internal table as occurs 5.

Read only

Former Member
0 Likes
487

Hi,

There are two methods that the system uses to perform allocations. In the first, occurs is non-zero, and the size of the internal table (calculated from occurs * number of bytes per row) is less than or equal to 8KB. (The number of bytes per row can be obtained using the describe table statement detailed in the next chapter, or via the Field view in the debugger.) When the first row is added to the internal table, memory is allocated from the program roll area. The amount allocated is equal to the calculated size of the internal table. If this amount is exceeded, an equal amount is allocated and the process is repeated until the total exceeds 8KB. When this happens, subsequent allocations obtain 8KB pages from the paging area.

If you specify occurs 0, all allocations are done in the paging area, causing one 8KB page to be allocated at a time. If the calculated size of the internal table is greater than 8KB, the system changes the occurs value to zero when the first allocation is done and all allocations are satisfied from the paging area.

Don't use occurs 0 if you expect to store less than 8KB in an internal table. If you do, the system will allocate 8KB from the paging area. Memory will be wasted and paging could increase, resulting in poorer performance.

But as suggested by SAP we should not use Occurs 0.

Rather we should use declare seperate workarea for the internal table.

Read only

former_member632991
Active Contributor
0 Likes
487

Hi,

Don't use occur while declaring internal tables. it is obsolete now.

occurs is related to the amount of memory that will be allocated for the internal table.

Regards,

Sonika

Read only

Former Member
0 Likes
487

0 Allocates 8kb of memory to table by default. If data exceeds 8kb, it assigns 8kb again.

1 means, It assigns one record memory every time dynamically. By default it contains memory for one record.

So, Memorywise 1 is better.

Regards.