Application Development 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: 

occurs clause

Former Member
0 Kudos

hi

can u plz tell me about occur clause.i want that when i mention occurs 2 in internal table it should only show 2 records and should not increase dynamically.

i don't want to increase the size of the memory dynamically.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

occurs 2 means when ever memory given to itab is same when use occurs 1 or 2 or .......

but it differs when after filling the initial record based on the value which user gives for ex:

occurs 2 means two more record space is allocated automatically and after fillling that two records then two more record space is allocated to internal table automatically. like this its goes on..........

if helpful reward some points.

with regards,

Suresh.A

6 REPLIES 6

Former Member
0 Kudos

Hi,

You cannot limit the size of the internal table using the "OCCUR" clause. this Occur is used in order to define the memory that the internal table should reserve at the start. and whenever the memory is getting scarce, the same amount of memory for the number mentioned inthe occur clause shall get reallocated to the internal table.

Occur clause is used in order to optimise the memory management.

<b>Reward points if this info helps,</b>

Kiran

0 Kudos

thanks kiran,

but plz can u tell me that suppose i have allocated memmory as 2 and i want only 2 records is it possible i want that it shot not increase dynamically...otherwise i have another option by using package size..but first i want to try with occurs clause i want that what ever i have mentioned should not increase dynamically

Former Member
0 Kudos

When u use occurs 2..

then in memory for two records, space is reserved..

but it doesn't mean that u can not store more than 2 records..

as u'll append more records, in memory space will be taken by those extra records...

If u don't append more than 2 records, then size of memory reserved will not increase..

so u need not to worry...

Reward if useful..

regards

Prax.

former_member223537
Active Contributor
0 Kudos

Hi,

If that is the case, then build following logic.

Loop at itab.

if sy-tabix GT 2.

delete itab.

endif.

endloop.

Best regards,

Prashant

Former Member
0 Kudos

hi

u cannot restrict the size of the internal table using occurs.

after storing 2 records then it will allocate memory for 2 more records.

use some logic to control it.

reward if useful

Former Member
0 Kudos

hi,

occurs 2 means when ever memory given to itab is same when use occurs 1 or 2 or .......

but it differs when after filling the initial record based on the value which user gives for ex:

occurs 2 means two more record space is allocated automatically and after fillling that two records then two more record space is allocated to internal table automatically. like this its goes on..........

if helpful reward some points.

with regards,

Suresh.A