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

Internal table

Former Member
0 Likes
659

Hi all,

I have a doubt in internal table concept.

data : begin of IT occurs 0,

-


-


end of IT.

In above 'occurs 0' means 8KB.

So maximum how many records can store in IT.

Thanks in advance.

6 REPLIES 6
Read only

bpawanchand
Active Contributor
0 Likes
642

Internal table reserves the memory it needs based on the number of entries that you enter.There are so many cases and situtation where in you need to store upto 5 lakh records in a internal table and it depends .

Read only

Former Member
0 Likes
642

Hi,

There is no restriction for Number of records in a internal table.

Read only

0 Likes
642

thanks Neenu.

Just refer the below code.

So what is the differeence between 'Occurs 0' and 'Occurs 1 and 2 etc'.

tables : pa0001.

data : it like pa0001 OCCURS 1 WITH HEADER LINE.

select * from pa0001 into TABLE it UP TO 10 ROWS.

loop at it.

write:/ it-pernr, it-ename.

endloop.

Read only

0 Likes
642

Actually there is no different. You can use either format to do the coding.

When you specify occurs 0, when the program is compiled. the compiler doesn't ready a default size for the working area. The internal table keep getting bigger as the size get bigger.

When you spcify occurs 1, then the compiler prepare a space or work area for one record line but if there are more than one record just like it happen in the occurs 0, the size of the internal table keeps getting bigger.

So basically there are no limit to how many data you can store.

CMIIW

Edited by: Suwardi Nursalim on Oct 28, 2008 11:15 AM

Read only

Former Member
0 Likes
642

Hi Shruthi,

you are right in 'OCCURS 0' means 8KB .

It means at the time of creation 8KB space is allocated for the internal table to store data and if the space get saturated with data another chank of *kb will be allocated to it.

While with OCCURS n , initial size is to store n rows of data and the same will be allocated to the table on getting saturation. Hope,it will solve your doubt in OCCURS 1.

Regards,

Anirban

Read only

Former Member
0 Likes
642

Hi,

OCCURS is an obsolete statement. Instead, use itab with work area (it's faster, more memory efficient and not obsolete).

Standard Tables Before Release 3.0

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,

...

f1...,

f2...,

...

END OF itab.

This statement declared an internal table itabwith 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 u20180u2019 had the same effect as omitting the INITIAL SIZE addition. In this case, the initial size of the table is determined by the system.

Edited by: Neenu Jose on Oct 28, 2008 10:20 AM