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
364

hi to all

i have defined itab as follows

data : begin of itab occurs 0.

DATA: BEGIN OF ITAB OCCURS 1 OR 2 OR 3 .

WHICH ONE IS TAKING HUGE MEMORY . AND WHICH ONE IS THE BETTER FROM PERFORMANCE POINT OF VIEW?

AND TELL ME ABT INITIAL SIZE ALSO

DATA : ITAB TYOE STANDARD TABLE OF KNA1 INITIAL SIZE 0 WITH HEADER LINE .

WHAT IS THE DIFFRENCE BETWEEN INITAIL SIZE AND OCCURS

WHICH ONE IS TAKING HUGE MEMORY OUT OF INITIALSIZE 1 AND INITILA SIZE 2 OR 0

PLS GIVE ME ANSWER IN DETAIL

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
332

Hi,

In regard to internal tables, header lines and the OCCURS extension are obselete. These are actually not allowed in the OO context. The correct way to define internal tables and work areas is to use a TYPE statement to define the structure and the table type and then to use a DATA statement to define the internal table and work area.

The size of the internal tables are set using the 'occurs n' clause. Here n refers to a integer number that specifies the size. Usually its given as 'occurs 0' which creates an itab with the memmory space of 8kb.

OCCURS n is obsolete in OO Context and it is advisable to use INITIAL SIZE instead. The difference between the two is that OCCURS n allocates memory to store specified number of rows in the internal table and also creates a header line, whereas INITIAL SIZE allocates memory for the specified number of rows without creating the header line.

For more information, please check this link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3646358411d1829f0000e829fbfe/content.htm

Regards,

Ferry Lianto

3 REPLIES 3
Read only

ferry_lianto
Active Contributor
0 Likes
333

Hi,

In regard to internal tables, header lines and the OCCURS extension are obselete. These are actually not allowed in the OO context. The correct way to define internal tables and work areas is to use a TYPE statement to define the structure and the table type and then to use a DATA statement to define the internal table and work area.

The size of the internal tables are set using the 'occurs n' clause. Here n refers to a integer number that specifies the size. Usually its given as 'occurs 0' which creates an itab with the memmory space of 8kb.

OCCURS n is obsolete in OO Context and it is advisable to use INITIAL SIZE instead. The difference between the two is that OCCURS n allocates memory to store specified number of rows in the internal table and also creates a header line, whereas INITIAL SIZE allocates memory for the specified number of rows without creating the header line.

For more information, please check this link.

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3646358411d1829f0000e829fbfe/content.htm

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
332

hi hari,

occurs 0 will create a page of 8kb where as Occurs 100 allows maximum 100 entries..

OCCURS 0 declaration type is a bit obsolete. In the future, SAP may not support this command any more.

Now it is almost the same, what type are you using.

LIKE STANDARD TABLE OF knows a bit more, because it can be LIKE HASHED TABLE OF, or LIKE SORTED TABLE OF.

So with this kind of declaration you can define much more table types.

Regards,

Jayant

Read only

Former Member
0 Likes
332

Hi,

Here Occurs 0 has default memory size that is 8kb.If u give it as Occurs 1 then it occupies only the memory that is required for 1 record.If u give it as Occurs 2 then it doubles the memory size.

Here as we know that Internal Table consists of body and an Optional header line.The body holds the rows of the internal table and the header line is a field string with a same structure as a row of the body.For default it takes only space for one record n when u say occurs 1 then it takes space for two records n for occurs 2 it doubles it takes space for four records n for occurs 3 six records....so occurs 3 needs more memory space.

if useful reward with points,

with regards,

Madhuri.