2008 Mar 23 6:49 PM
DATA: IT_EKKO TYPE STANDARD TABLE OF I_Table
INITIAL SIZE 0,
data:begin of i_table occurs 0.
what is the difference between the above statements ? ie...
what is the difference between INITIAL SIZE 0, and occurs 0 ?
explain plzz ?
2008 Mar 24 9:06 AM
Hi,
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 memory space of 8kb.
OCCURS n is bit obsolete in OO Context and it is advisable to use INITIAL SIZE instead.
The difference between the two is :-
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.
regards,
preet.
p.s:- reward if helpful
Hi,
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 memory space of 8kb.
OCCURS n is bit obsolete in OO Context and it is advisable to use INITIAL SIZE instead.
The difference between the two is :-
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.
regards,
preet.
p.s:- reward if helpful
2008 Mar 23 9:44 PM
Hi,
Both are same...Pls see some help from SAP site..
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 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 above statement is still possible in Release 4.0, and has roughly the same function as the following statements:
TYPES: BEGIN OF itab,
...
f1...,
f2...,
...
END OF itab.
DATA itab TYPE STANDARD TABLE OF itab
WITH NON-UNIQUE DEFAULT KEY
INITIAL SIZE n
WITH HEADER LINE.
In the original statement, no independent data type itabis created. Instead, the line type only exists as an attribute of the data object itab.
Hope this will help you.
Thanks & Regards,
Siri.
2008 Mar 24 3:52 AM
Hi
Initial Size 0 will always allocate 8 Kb of memory area to the internal table. Further memory allocations will be dynamic i.e. as you add entries into internal table system will assign next blocks in chunks of 12kb each.
Initial size 10 will allocate the memory depending on the line wodth of your internal table . If your table line
Is 80 Bytes Long - Intial Memory allocated would be
8 kb as ( 80 X 10 = 800 b is less than 8 Kb and system will not allocate less than 8 kb. )
Is 900 bytes long then Initial memory allocation would be 20 kb ( 900 X 10 = 9000 Bytes , is greater than 8 kb so the next block of memory is released ).
In nutshell occurs or initial size only affect the initial memory space allocation of int. table. All subsequent memory blocks are 12 Kb.
For custom programs occurs 0 or initial size 0 is good as system will take care of memory allocation. In any case you can only change the initial memory allocation by these two key words.
Regards,
Ferry Lianto
2008 Mar 24 5:13 AM
Hai Akash,
Both INITIAL SIZE And OCCURS 0 are Same AND Both ALLOCATE 8 Kb Memory FOr Internal Table .
But In New Versions We Are using NEW SYNTAX.
AND In This New Versions We Will Never use HEADER Line.
So We Will Use INITIAL SIZE 0.
Regards.
Eshwar.
2008 Mar 24 9:06 AM
Hi,
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 memory space of 8kb.
OCCURS n is bit obsolete in OO Context and it is advisable to use INITIAL SIZE instead.
The difference between the two is :-
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.
regards,
preet.
p.s:- reward if helpful
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |