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

What does this mean

Former Member
0 Likes
1,537

*DATA:BEGIN OF it_data OCCURS 0

what does occurs 0 mean?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,501

Hi Dilip,

occurs 0 means a internal table will be allocated 8kb of

memory initially.if it needs more then again 8 kb of is

allocated to it.

Reward if useful,

Regards,

S.Suresh.

*DATA:BEGIN OF it_data OCCURS 0

what does occurs 0 mean?

12 REPLIES 12
Read only

Former Member
0 Likes
1,501

The OCCURS <n> signifies the compiler that the declaration is for an internal table....

Reward if useful.

Regards

Shiva

Read only

Former Member
0 Likes
1,501

Hi,

Use of Occurs - If you use the OCCURS parameter, the value of the INITIAL SIZE of the table is returned to the variable <n>

Data :  Begin of ITAB occurs 0,

 

                        End of ITAB.

Occurs or Initial Size – to specify the initial amount of memory that should be assigned to the table.

Yes, we can change the occurs value in program but output remains the same.

Read only

Former Member
0 Likes
1,501

hi,

When we use Occurs 0 no memory will get allocated to that internal table.

When we use Occurs 1 reserved the memory for one record.If you add more records than occurs number in Both cases memory will get incresed automatically.Occurs with number we will use only when we total number of records to be stored.

Regards,

Santosh

Read only

Former Member
0 Likes
1,501

Hi,

OCCURS addition is generally used to reserve memory for the internal table corresponding to those many rows.

In case of Occurs 0, it only means that the data declared before occurs word is going to be an internal table, with no pre-reserved memory space.

It DOES NOT mean that the table cannot have any rows. The internal table so declared can have any number of rows appended (upto the max limit of an internal table, ofcourse).

Do let me know if this helped.

Thanks,

Pranjal.

Read only

Former Member
0 Likes
1,501

This creates an internal table with header line and allocates

8KB of memory(space) to the internal table ...

Read only

Former Member
0 Likes
1,501

HI,

occurs 0 will create a page of 8kb..

REWARD IF USEFUL

Read only

Former Member
0 Likes
1,501

hi,

by using this, you can store the records in the Internal table, If you give Occues 0 then we are giving ful space(8kb) to Internal table, if you give occurs 5, then you are assiging less space, this is very usefull for large amount of data, if the total no of records in the internal table execced the 8kb, then the system automatically assign 8kb space again, so if you are dealing with small amount of data in the internal table, then make use of this occurs N, so you won't get any memero related problems

Hope this helps, Do reward.

Read only

Former Member
0 Likes
1,501

Hi ,

Suppose I write Occurs 4 ,then it wud mean whenever an internal table is falling short of rows , 4 new rows will get added to it.

but there is one problem, suppose I have 5 records..then 4 will get stored in one go and next time 4 more rows will be added however there is a requirement of only one extra row, so our memory is wasted.

This is the reason we always write OCCURS 0 which means whenever internal table is falling short of rows add only the rows required and hence this saves memory..

Revert back if u have doubts...

Please reward points if helpful

Manish

Read only

Former Member
0 Likes
1,501

DATA BEGIN OF itab OCCURS n.

The data object n that has to be specified as a numeric literal or numeric constant determines the initial memory requirement.

Thanks,

Vibha

Please mark all the useful answers

Read only

Former Member
0 Likes
1,501

when you write OCCURS 0. the ABAP interpreter assigns 8kb memory in application server for that particular internal table,.

There is no other concept likfe OCCURS 1 , OCCURS 2 as people say that there u can store only one row in internal table,.,,

This thought is completely wrong....

Read only

Former Member
0 Likes
1,502

Hi Dilip,

occurs 0 means a internal table will be allocated 8kb of

memory initially.if it needs more then again 8 kb of is

allocated to it.

Reward if useful,

Regards,

S.Suresh.

Read only

Former Member
0 Likes
1,501

It just deals with the memory and when u write occurs 0 it means the memory allocated for ur structure declaration is 8kb, according to ur records u can increase ur memory size.

And when u declare ur internal table with Begin OF keyword that indicates with Header LINE.

THks