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

Occurs

Former Member
0 Likes
1,263

what is the difference between occurs 0 and occurs 100.

Which is beter in terms of performance ..Why ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,229

hi,

occurs stmnt is just for allocating memory for internal table . occurs 0 gives less memory whereas occurs 100 gives huge memory.

performance wise it is not recommended to use occurs in ver 4.7 and above

regards,

Navneeth.K

hi,

occurs stmnt is just for allocating memory for internal table . occurs 0 gives less memory whereas occurs 100 gives huge memory.

performance wise it is not recommended to use occurs in ver 4.7 and above

regards,

Navneeth.K

13 REPLIES 13
Read only

Former Member
0 Likes
1,230

hi,

occurs stmnt is just for allocating memory for internal table . occurs 0 gives less memory whereas occurs 100 gives huge memory.

performance wise it is not recommended to use occurs in ver 4.7 and above

regards,

Navneeth.K

Read only

Former Member
0 Likes
1,229

The In occurs n, n defines the number of records you can store in itab.

So as a performance if you dont require much records for processing use occurs 0

Thanks

sandeep

Reward if helpful

Read only

Former Member
0 Likes
1,229

Hi,

A number after OCCURS specifies the initial memory assignment.

If u specify OCCURS 100 then it says that define an internal table with initially a capacity to store 100 rows. As the rowcount exceeds 100, another group of 100 rows is appended to the table.

However, if Occurs 0 is specified, the that means define internal table only with headre and append blank row one by one as needed.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,229

Hi Kumar,

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

Regards,

Priyanka.

Read only

0 Likes
1,229

hi priyanka ,

i just want to know that hw much memory is allocated in 8 kb .

supose i have to insert 500 lines should i write occurs 0 or occurs 500 .

vivek singh

Read only

Former Member
0 Likes
1,229

occurs 0 -


> Initiall allocates no memory to itab

occurs 100 -


> Initially allocates memory for 100 records

i guess the first one should give better performance

Read only

Former Member
0 Likes
1,229

Hi Kumar,

occurs 0:memory will b allocated for one record i.e 8kb

occurs 100:memory allocated for 100 records.

Read only

Former Member
0 Likes
1,229

hi Kumar,

Occurs is used to preserve a buffer in ABAP memory for the expected number

of records in an internal table.

Always, this has to be implemented based on a trial and error method, like

by trying to see how many records would be fetched into internal table.

occurs 100 is always better than occurs 0 if a min of 100 records is expected

in the internal table.

Hope this helps,

Sajan Joseph.

Read only

Former Member
0 Likes
1,229

hi

'occurs 0' which creates an internal table with the memmory space of 8kb.

this specifies the size of the itab.

occurs 0 can be used for better performace, but not recommended though for the latest versions

regards,

madhu

Read only

Former Member
0 Likes
1,229

Hi Chandarasekar ,

Occurs 0 , I have heared that 8 KB is allocated ,You are telling 0 memory ?

Read only

0 Likes
1,229

yeah, chk the help

Internal tables are a dynamic data structure. Their memory requirements

are met in blocks. The initial memory allocation (hereafter called the

OCCURS area), can be controlled using the "OCCURS n" or "INITIAL SIZE n"

addition in the table definition (see DATA, TYPES). Once the OCCURS area

is full, the next block to be created is twice as big as the OCCURS area

(as long as this is not greater than 8 KB). All further blocks are then

created with a constant size of 12 KB.

You can leave it to the system to determine the size of the OCCURS area

by specifying n = 0. In this case, the system allocates only a "small"

portion of memory at the first INSERT or APPEND statement. "OCCURS 0" or

"INITIAL SIZE 0" means that 16 <= n <= 100 (depending on the line

width).

It only makes sense to specify a concrete value of n > 0 when you know

exactly how many entries the table will have, and you want to set up the

OCCURS area exactly. This can be particularly important if you want to

nest internal tables (where an "outer" internal table contains one or

more other internal tables in each line, and the "inner" tables only

have a few entries (no more than 5, for example).

To avoid excessive memory requirements, the system handles large values

of n as follows: The largest possible value of n is n_max = 8 KB divided

by the line width. For larger values, n is set such that n multiplied by

the line width is around 12 KB.

Read only

Former Member
0 Likes
1,229

Hi Kumar,

Occurs 0 statement used for internal table when it applies the table having a place in body and continues it whenever data is coming.

beside it Occurs 100 works same but it place the 100 line memory.when 100 lines fill in body again 100 lines take place.

so if you know the coming data.you should use occurs (no.) and when u don't know abt it u used occurs 0.

this is best 4 memory storage and better performence for program.

I think this answer satisfy u.

If useful u think reward me with points.

Thanks

Sanket.

Read only

Former Member
0 Likes
1,229

Hi,

OCCURS 0 is betten than OCCURS 100 because

OCCURS 100.

*****************

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.

REAL TIME EXAMPLE: BUS

***************************

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:

**************

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

IF USEFULL REWARD