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

Code Inspector Checks

Former Member
0 Likes
679

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

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
656

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.

4 REPLIES 4
Read only

Former Member
0 Likes
656

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

Read only

Former Member
0 Likes
656

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...

Read only

vinod_vemuru2
Active Contributor
0 Likes
657

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.

Read only

0 Likes
656

Thanks Vinod...

doubt is clear now...