Difference Between INITIAL SIZE and OCCURS N
Can u please clear me with the "Difference Between INITIAL SIZE and OCCURS N"
Expecting Your answers
Thanks & Regards,
<b>1. Difference between INITIAL SIZE and OCCURS?
OCCURS is obsolete and is no longer valid in OO ABAP. It defines an internal table with memory allocated to store a specified number of rows of the internal table in the main memory. It also provides you with a header line by default.
INITIAL SIZE will also allocate the initial memory but will not define your header line. The only thing is that it cannot be used with generic table types like ANY TABLE or INDEX TABLE.
2. When should I use INITIAL size. Are there any specific cases?
If you are in newer versions, it may be advisable to start using it in every case.
3. Is there any performance issue if I use INITIAL SIZE?
Using initial sze you are telling the system to allocate a certain portion of the available memory for this internal table. Unless you are very confident about the size of your internal table, it is not advisable to reserve this memory. This will be useful only if you know that you will have a specific number of records in your internal table, like preloading all the material types into the table.
4. Why OCCURS is not recommended?
We only know that it is not allowed in ABAP objects, why I don't know. May be any implicit header work area is not in line with object oriented programming.
5. Is it true that if I use OCCURS then the internal table is created with header line? With INITIAL SIZE header line is not created?
As explained above, YES.
6. What is the difference between INITIAL SIZE 0 and INITIAL SIZE 10?
Exaplained above in 3.
If these answers helped you, please reward and close the post.</b>