‎2008 Jul 23 9:59 AM
Hi All,
I am doing Code Inspector Check for my Program.
Doing this, I am getting an Error Message Indicating to use TYPE TABLE OF instead of OCCURS 0 statement while declaring Internal Tables.
Question is, Is there any difference between TYPE TABLE OF and OCCURS 0 (Performance wise) ?
Helpful answers will be rewarder by points.
Thanks & Regards
Swatantra Pathak
‎2008 Jul 23 10:11 AM
HI,
Yes.
OCCURS 0 is obsolete now.
When we define internal table with OCCURS 0 it will allocate a default memory of 8KB. In TYPE TABLE/STANDARD TABLE OF it is dynamic i.e as and when we get a record memory will be allocated.
eg: If ur itab is with OCCURS 0 and u have data of size 2kb then 6KB memory is wasted i.e allocated and not used.
eg2: If ur itab is with OCCURS 0 , Each record accupies 1 KB. Then after filling 8 records and at the time of getting 9 th records another 8KB is allocated. If u have 9 records in ur table then 7KB is wasted.
If u r getting allocated with some memory(Resource) and not using means performancewise it is bad.
Hope above examples are clear.
Thanks,
Vinod.
‎2008 Jul 23 10:03 AM
When we define an internal table like
DATA itab TYPE STANDARD TABLE OF T001.
we create an internal table without a heading record, with the same exact structure of T001.
If you define an internal table using OCCURS, which seems to be outdated, you explicitly define the table's size.
So TYPE TABLE OF is better..
Reward points if useful
thanks and regards,
Nishant
‎2008 Jul 23 10:05 AM
hi check this...
occurs 0 will allocate a memory of 8kb statically....but
type standard table is a dynamic one it will allocate memory dynamically for the internal table...
‎2008 Jul 23 10:11 AM
HI,
Yes.
OCCURS 0 is obsolete now.
When we define internal table with OCCURS 0 it will allocate a default memory of 8KB. In TYPE TABLE/STANDARD TABLE OF it is dynamic i.e as and when we get a record memory will be allocated.
eg: If ur itab is with OCCURS 0 and u have data of size 2kb then 6KB memory is wasted i.e allocated and not used.
eg2: If ur itab is with OCCURS 0 , Each record accupies 1 KB. Then after filling 8 records and at the time of getting 9 th records another 8KB is allocated. If u have 9 records in ur table then 7KB is wasted.
If u r getting allocated with some memory(Resource) and not using means performancewise it is bad.
Hope above examples are clear.
Thanks,
Vinod.
‎2008 Jul 23 10:20 AM