2007 Jul 17 12:37 PM
Hi,
Can anybody tell why the declaration of internal table occurs 0 and internal table with header line is obsolate now?
Explain the adavantages of newer one.
is there any performance related issue?
Thanks in advance
Debjani Lahiri
2007 Jul 17 12:42 PM
Hi
Internal table with header line has the Following limitaitons:
1. It cannot be used as a component in nested internal tables
2. ABAP Objects does not support them
Occurs Clause is obselete bcoz.
SAP has introduced new internal table concept where we can create different types of internal tables like STANDARD, SORTED, HASHED.
These internal tables provide better performance based on the operations.
For: Eg
HASHED TABLE:
Access time is Constant :
So it is suitable for large amount of data records where access is only based on Unique key
Hope this gives u idea.
Reward if it helps.
2007 Jul 17 12:42 PM
well point 1 and most important point is to keep th code readable.
especially for people which dont have 10 years expierience.
Declaration of tables witrh headerline allow e.G. following code.
Modify Itab.
thats aweful. modify the itab from what?
there are other reasons as well tho i cant remeber em all.
2007 Jul 17 12:42 PM
Hi
Internal table with header line has the Following limitaitons:
1. It cannot be used as a component in nested internal tables
2. ABAP Objects does not support them
Occurs Clause is obselete bcoz.
SAP has introduced new internal table concept where we can create different types of internal tables like STANDARD, SORTED, HASHED.
These internal tables provide better performance based on the operations.
For: Eg
HASHED TABLE:
Access time is Constant :
So it is suitable for large amount of data records where access is only based on Unique key
Hope this gives u idea.
Reward if it helps.
2007 Jul 17 12:44 PM
Hello,
Please reward if found helpfull.
In occurs zero system desides the no of lines of the itab dynamically if say you want to enter 10 records then after inserting every record it will increase the no of lines of itab by 1,instead of occurs zero you can also write occurs 5 or 10 or anything but if this case it will use up more memory.
Specifying OCCURS 0 will allow the system to decide about the memory management of the internal table, instead of reserving memory space for a predefined number of entries like in case of, say, OCCURS 10.
By the way, the OCCURS parameter is considered to be obsolete in ABAP Objects, so it's probably better to use a different internal table declaration method everywhere such as ...TABLE OF...
Example if you use occurs 10 then for an itab with 11 lines after entering the 10th line it will again add 10 blank rows to the itab, keeping 9 rows blank.
Regards,
Rakesh.
2007 Jul 17 12:48 PM
In OO context Internal table with Header line concept is Obsolete.
You have to Declare your internal tables with out header line using types.
It is performace related issue .
That is the reason with out header line is preferred.
Regards
Vijay
2007 Jul 17 1:09 PM
Hi,
Like all other data objects, you can declare internal table objects using the LIKE or TYPE addition of the DATA statement.
DATA <itab> TYPE <type>|LIKE <obj> [WITH HEADER LINE].
Here, the LIKE addition refers to an existing table object in the same program. The TYPE addition can refer to an internal type in the program declared using the TYPES statement, or a table type in the ABAP Dictionary.
You must ensure that you only refer to tables that are fully typed. Referring to generic table types (ANY TABLE, INDEX TABLE) or not specifying the key fully is not allowed (for exceptions, refer to Special Features of Standard Tables).
The optional addition WITH HEADER line declares an extra data object with the same name and line type as the internal table. This data object is known as the header line of the internal table. You use it as a work area when working with the internal table (see Using the Header Line as a Work Area). When you use internal tables with header lines, you must remember that the header line and the body of the table have the same name. If you have an internal table with header line and you want to address the body of the table, you must indicate this by placing
brackets after the table name (<itab>[]). Otherwise, ABAP interprets the name as the name of the header line and not of the body of the table. You can avoid this potential confusion by using internal tables without header lines. In particular, internal tables nested in structures or other internal tables must not have a header line, since this can lead to ambiguous expressions.
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>,
...
<fi> ...,
...
END OF <itab>.
This statement declared an internal table <itab> with 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.
Regards,
Bhaskar