Tuesday, 7 January 2014

Types of Internal Tables - SAP ABAP

Types of Internal Tables - SAP ABAP

Now the difference between the older and newer style internal tables has been men-tioned, from here on, assume that it is the newer kind which is being discussed - an inter-nal table with a work area.
An internal table can be made up of a number of fields, corresponding to the columns of a table, just as in the ABAP dictionary a table was created using a number of fields. Key fields can also be used with in internal tables and when creating these internal tables offer slightly more flexibility. In the ABAP dictionary, using key fields is imperative to uniquely identify each record. With internal tables, one can specify a non-unique key, allowing any number of non-unique records to be stored, allowing duplicate records to be stored if re-quired.
Different types of internal tables can also be created, so that data can be accessed in the most efficient manner possible
Standard Tables
First, there are standard tables. These give the option of accessing records using a table key or an index. When these tables are then accessed using a key, the larger the internal table is, the longer it will take to access the records. This is why the index option is also available. Standard tables do not give the option of defining a unique key, meaning the possibility of having identical lines repeated many times throughout the table. Addition-ally, though, this means that standard tables can be filled with data very quickly, as the system does not have to spend time checking for duplicate records. Standard tables are the most commonly used type of internal table in SAP systems
Sorted Tables
Another type of internal table is the sorted table. With these, a unique key can be defined, forcing all records in the table to be unique, removing duplication. These can again be ac-cessed via the key or index. As the records are all unique, using the table key to find re-cords is much quicker with sorted tables, though still not the fastest in all situations. It is often preferable to use a sorted table over a standard table, given the faster access speeds and the fact that this kind of table will sort records into a specific sequence. This gives one a substantial performance increase when accessing data
Hashed Table
The final type of internal table to be discussed here is a hashed table. With these, an index is not used to access the data, only a unique key. When it comes to speed, these are likely to be the preferred option. These are recommended particularly when one is likely to be creating tables which will be very large, as accessing data in large table is likely to be fairly laboured when using standard or sorted tables. These tables use a special hash algorithm to ensure the fast response times to reading records are maintained no matter how many records are held.
Despite the speed of hashed tables, you will however find that standard and sorted tables are generally used significantly more in SAP programs. Because of this, the majority of fo-cus here will be put on these

No comments:

Post a Comment