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,055

BEGIN OF i_out OCCURS 0

what does this mean

9 REPLIES 9
Read only

Former Member
0 Likes
1,034

Hi,

Occurs 0 means, table i_out with header line.

Pranav

Read only

Former Member
0 Likes
1,034

Hi,

internal table can hold maximum records possible

When you declare the itab as occurs 0, the system allocates memory in multiples of 8kb as and when the the itab needs it ie depending on the number of entries in the itab.

regards

Read only

Former Member
0 Likes
1,034

occurs 0 means that initially only 8kb is allocated for the internal table.then as and when the record is added, it expands. since u dont know the volume of records it is best to use 'occurs 0'.

regards,

madhu

Read only

nivaskumar2
Explorer
0 Likes
1,034

Occurs 0 :

It is a keyword that creates internal table with or without header line.

Occurs 0 means, the size of the table header for an initial table is 8 bytes. Unlike all other ABAP data objects, you do not have to specify the memory required for an internal table. Table rows are added to and deleted from the table dynamically at runtime by the various statements for adding and deleting records.

So we can call occurs X as initial size of the internal table.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Mar 19, 2008 5:13 PM

Read only

Former Member
0 Likes
1,034

Hi,

Occurs 0 means when you declare a internal table with occurs 0, by default it will allocate 8kb of memory for the internal table, as the size of the internal table increases memory will be increases by 8kb.

Occurs 0, internal table with header line.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,034

Hi,

Before Release 3.0, internal tables all had header lines and a flat-structured line type. There

were no independent table types. You could only create a table object using the OCCURS

addition in the DATA statement, followed by a declaration of a flat structure:

DATA: BEGIN OF <itab> OCCURS <n>,

...

<fi> ...,

...

END OF <itab>.

This statement declared an internal table <itab> with the line type defined following the OCCURS addition. Furthermore, all internal tables had header lines.

The number <n> in the OCCURS addition had the same meaning as in the INITIAL SIZE addition from Release 4.0. Entering ‘0’ had the same effect as omitting the INITIAL SIZE addition. In this case, the initial size of the table is determined by the system.

The above statement is still possible in Release 4.0, and has roughly the same function as the following statements:

TYPES: BEGIN OF <itab>,

...

<fi> ...,

...

END OF <itab>.

DATA <itab> TYPE STANDARD TABLE OF <itab>

WITH NON-UNIQUE DEFAULT KEY

INITIAL SIZE <n>

WITH HEADER LINE.

In the original statement, no independent data type <itab> is created. Instead, the line type only exists as an attribute of the data object <itab>.

Regards,

Bhaskar

Read only

Former Member
0 Likes
1,034

HI,

OCCURS 0------it is for allocating memory,initially 8kb memory is allocated first and then based on the records the size of memory also automatically increases.

but perfromnce wise it is not suggested to use this OCCURS 0.

if we only exactly how many records we r adding,based on that we can declare for eg occurs 8 etc.,

Regards,

vineela.

Read only

Former Member
0 Likes
1,034

HI,

occurs 0 means that initially only 8kb is allocated for the internal table.then as and when the record is added, it expands. since u dont know the volume of records it is best to use 'occurs 0'.

PANKAJ

Read only

Former Member
0 Likes
1,034

Hi,

While coding avoid using occurs statemet.Now in new versions SAP has mad like satement as OBSOLETE

instead of that use TYPES and TYPE STANDARD TABLE of.

Basically occurs 0 means it creates a workarea or header for a internal table implicitly,as other have suggested is given max memory.Suppose your internal table is having only one record tehn rest of the memory won't be used.So please avoid using occurs.

Suppose say you know a internal table can have max 10 records,then you can use occurs 10 as it provide memory for 10 records at a time.Say if the internal table is having 11 records then it would place another slot of memory for another 10 records,as we have only 1 records rest of the memory for 9 records will be wasted.

Regards,

Prakash