40 Flares Twitter 0 Facebook 40 Google+ 0 LinkedIn 0 Email -- 40 Flares ×

What is Internal Table ?

Internal table is a collection of fields with different data types where you can store  any number of records temporarily.

Internal Table Types:

3 types of internal tables are there

1. Standard internal tables

2. Sorted internal tables

3. Hashed internal tables

Standard internal table:

It accepts the duplicate records

Standard tables have a liner index, we can access them using either the index or the key

READ TABLE <ITAB> INTO <WA> INDEX <N>.

(Or)

READ TABLE <ITAB> INTO <WA> WITH KEY <Condition>.

Append keyword is used to insert the data into Standard internal tables

Syntax:  append <work area> to <Internal Table>.

Syntax:

Data: <Itab> type standard table of <work area name>.

Accessing/Searching time for the record depends on the No of Records because Searching is Liner

Sorted internal table:

It may or may not accept the duplicate records

Insert keyword is used to insert data into sorted internal table

Syntax : Insert <work area>  into  <internal Table>.

Searching of the records by using the binary search

Note: records can be accessed through both INDEX and with KEY (Condition).

Note: Sorted Internal tables cannot be sorted again.

 

Sorted internal tables are always either UNIQUE/ NON UNIQUE i.e. sorted internal tables cannot be declared without UNIQUE/NON-UNIQUE keyword

Syntax : DATA <ITAB> TYPE SORTED TABLE OF <TY> WITH UNIQUE/NON-UNIQUE KEY <F1><F2>…

Hashed internal tables:

This is the most appropriate type for any table where the main operation is key access.

It won’t accept duplicate records

Syntax:

DATA <ITAB> TYPE HASHED TABLE OF <TY> WITH UNIQUE/NON-UNIQUE KEY <F1><F2>…

You cannot access a hashed table using its INDEX.

The response (Search) time doesn’t depend on the number of records, instead it always remain constant regardless the number of table entries.

Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for processing large amounts of data.

Insert keyword is used to insert data into sorted internal table

Syntax : Insert <wa> into table <Itab>.

That’s it.

Enjoy 🙂

Also Read:

Dynamic selection screen in SAP ABAP.

Implement the BADI to download the vendor Data in a excel sheet.

Hierarchical ALV Report in SAP ABAP

40 Flares Twitter 0 Facebook 40 Google+ 0 LinkedIn 0 Email -- 40 Flares ×