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

hi friends,

Could u plz tell me what is the purpose of occurs 0?????

thanks in advance.

regards,

Priya.S

hi friends,

Could u plz tell me what is the purpose of occurs 0?????

thanks in advance.

regards,

Priya.S

9 REPLIES 9
Read only

Former Member
0 Likes
1,124

Hi,

By using Occurs 0, it will by default allocate 8kb of memory for the internal table. whenever the internal table having more than 8kb, it will allocate the more 8kb.

And also it will create a internal table with header line.

Thanks,

Sriram Ponna.

Read only

Clemenss
Active Contributor
0 Likes
1,124

Hi Prya,

OCCURS 0 is the obsolete form of declaration for an internal table.


DATA: 
  begin of whatever OCCURS 0,
  f1 type whatevertype1,
  f2 type whatevertype2,
...
  end of whatever.
* would be written tody as
TYPES;
  begin of ty_whatever OCCURS 0,
  f1 type whatevertype1,
  f2 type whatevertype2,
...
  end of ty_whatever.
DATA:
  t_whatever type table of ty_whatever with header line.

Regards,

Clemens

Read only

Former Member
0 Likes
1,124

Hi

Occurs 0 is just to create an nternal table with a header line.

Thanks and Regards

Palak Behal

Read only

Former Member
0 Likes
1,124

hi,

Occurs 0 is for creating a internal table with header line.

and it automatically allocates some memory to our internal table.

and it has become obselete in new versions.

if found helpful do reward,

regards,

bharathi

Read only

Former Member
0 Likes
1,124

HI

occurs 0 it wil allocate 8kb of memory.

data : itab like kna1 occurs 0

it wil create a internal table with header line...and allocates

8 kb of memory.

Read only

Former Member
0 Likes
1,124

Hi,

Occurs 0 allocats 8kb of space,once data has been filled then

again it allocats 8kb of space for internal table.

Regards,

Chandu.

Read only

Former Member
0 Likes
1,124

hi,

occurs creates the body of the internal table. Occurs 0 means the system allocates 8KB pages of memory at a time.

Read only

Former Member
0 Likes
1,124

hi priya,

data: begin of it_kna1occurs 0,

-


-


,

end of it_kna1.

OCCURS 0 means it creates a body of the internal table which of size 8kb defaultly.We can specify any number with occurs addition.i.e occurs 0 ,occurs1,occurs2,...............

performance wise OCCURS 0 is not Suggestable.because if the internal table contains less no .of records which occupies memory lessthan 8kb.so wastage of memory. so we have to allocate memory dynamically.

thanks,

raji

reward if helpful

Read only

Former Member
0 Likes
1,124

Hi Priya,

Occurs addition will give default memory space.

If u donot add that then defined object behaves like a workarea instead of int table.

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 initial memory requirement defined during the creation of the internal table with the addition INITIAL SIZE or the obsolete addition OCCURS is determined and assigned to the data object n. The data type i is expected for the data object.

Check the links

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.

But this method of declaring itab is no longer recommended & also obsolete in ABAP Objects.

Hope this helps a bit..

Reward if useful

Cheers

Kripa Rangachari.