‎2007 Jun 21 10:31 AM
Hi!
Whats the diff b'tween occurs 0 and occurs 10 w.r.t creating itab.
‎2007 Jun 21 10:38 AM
Rahul,
When you say occurs 0 ,it don't allocate any memory for that internal table.
If you say OCCURS 10 it will allocate 10 records memory for that table.
Ex: Suppose you are using occurs 100000.Memory will get allocated for 100000 records.though you are updating 1000 records allocated memory is 100000.
Waste of memory.
If you are using more than your OCCURS number dynamically it will allocate required memory.
Don't forget to reward if useful.
‎2007 Jun 21 10:34 AM
Hi
It is used for Memory allotment
It is better to declare with Occurs 0 always
because internal tables will take the required memory based on the data they get at run time.
Occurs 10 means you are initially reserving some 10 X 8 Kb like data memory in advance
Reward points for useful Answers
Regards
Anji
‎2007 Jun 21 10:35 AM
Hi,
Occurs 0 and Occurs 10 or Occur xx..it means that you are informing the program that there can be initial of so many rows and memory will be preallocated to accomdate the same. Now this is no more used. Also there is a default memory allocated for a table depending on the size. I have really not seen any benefit but only useful in interviews
Reward if useful...
Thanks...
Preetham S
‎2007 Jun 21 10:35 AM
The OCCURS or INITIAL SIZE parameter (OCCURS value) determines the number of lines that are created when the table itself is created. However, the table is extended dynamically on demand.
The OCCURS value, has no other semantic meaning. If you do not specify an INITIAL SIZE , the system uses the default value 0.
‎2007 Jun 21 10:37 AM
Hi,
occurs 0, the memory allocation is done by system,
in case of occurs 100 memory of 100 records allocated initially ,then if records exceeds then system ll allocate memory,
memory allocation here is known as extent and depend upon basis administrator...
You can use the above addition to reserve memory space for <n> table lines when you declare the table object.
When this initial area is full, the system makes twice as much extra space available up to a limit of 8KB. Further memory areas of 12KB each are then allocated.
You can usually leave it to the system to work out the initial memory requirement. The first time you fill the table, little memory is used. The space occupied, depending on the line width, is 16 <= <n> <= 100.
It only makes sense to specify a concrete value of <n> if you can specify a precise number of table entries when you create the table and need to allocate exactly that amount of memory (exception: Appending table lines to ranked lists). This can be particularly important for deep-structured internal tables where the inner table only has a few entries (less than 5, for example).
To avoid excessive requests for memory, large values of <n> are treated as follows: The largest possible value of <n> is 8KB divided by the length of the line. If you specify a larger value of <n>, the system calculates a new value so that n times the line width is around 12KB."
Regards,
Padmam.
‎2007 Jun 21 10:38 AM
Rahul,
When you say occurs 0 ,it don't allocate any memory for that internal table.
If you say OCCURS 10 it will allocate 10 records memory for that table.
Ex: Suppose you are using occurs 100000.Memory will get allocated for 100000 records.though you are updating 1000 records allocated memory is 100000.
Waste of memory.
If you are using more than your OCCURS number dynamically it will allocate required memory.
Don't forget to reward if useful.
‎2007 Jun 21 10:46 AM
OCCURS ... is an obsolete form of coding (ver 4 on).
Better is
DATA I_TAB1 TYPE TABLE OF ... <i>INITIAL SIZE xx</i>
If you omit INITIAL SIZE, then it will assume 0.
SAP have a note about how memory is used in an internal tables - 82882.
Basically if you know how many entries the table could hold, then provide that as the size.
Otherwise leave as 0 an SAP will grab a chunk of memory - 8 MB the first time a row is inserted in the table.