‎2009 Aug 14 6:18 AM
why do we declare internal tables in this way
TYPES: BEGIN OF ty_t501t,
..
...
END OF ty_t501t.
DATA: gt_list1 TYPE STANDARD TABLE OF ty_list1,
why not this
DATA: BEGIN OF ITAB OCCURS 0,
....
....
.....
END OF ITAB.
‎2009 Aug 14 6:22 AM
Hi ,
The reason for this being that is it not a good practice to declare internal tables with header lines , as they are not allowed in object oriented concept .
When you declare an internal table with header line it results in the same name for two objects one the internal table and the other the work area , hence the practice to define separate data objects for table and the work area.
Regards,
Arun
‎2009 Aug 14 6:22 AM
Hi ,
The reason for this being that is it not a good practice to declare internal tables with header lines , as they are not allowed in object oriented concept .
When you declare an internal table with header line it results in the same name for two objects one the internal table and the other the work area , hence the practice to define separate data objects for table and the work area.
Regards,
Arun
‎2009 Aug 14 6:23 AM
if at all if you need any changes if you make changes to Ty... will be enough...
and you can create many internal tables... using that TY with a single line code...
‎2009 Aug 14 6:25 AM
Hi,
Declaring internal table with a header line decreases performance.
Its better to have internal table without header line and a work area to work with it.
Its improves performance.
Also wen u work with internal table with header line it creates confusion that whether ur working with the header line or body of the internal table.
Also declaring internal table with header line is obsolete one.
LOOP AT ITAB----
>Working with header line.(Confusion whether ur referring header or body of internal table)
LOOP AT ITAB INTO WA------>Working with internal table widout header line and an work area
Regards,
Lakshman.
Edited by: Lakshman N on Aug 14, 2009 7:25 AM
‎2009 Aug 14 6:27 AM
When we declare an internal table using DATA statement, it creates an internal table with headerline.
Use of internal tables with header is not recommended. Such internal tables can cause serious bugs
in the code.
So normal we declare a type using TYPE statement and then declare the internal table using the newly declared
type.
In this case we have to create a separate workarea to perform operations on the internal table.
Use of workarea makes our code easy to understand. Also there are less chances of error if we use workareas
rather than internal table with headerline and bebugging becomes simple.