- SAP ABAP
- What is SAP ABAP
- SAP ABAP Data Dictionary and Domain
- SAP ABAP Data Element
- SAP ABAP Database Table
- SAP ABAP Database tables and views
- SAP ABAP Foreign Key
- SAP ABAP Indexes
- SAP ABAP Structure
- SAP ABAP Package
- SAP ABAP Adding Fields to SAP Standard Table
- SAP ABAP Internal Table and Database Table
- SAP ABAP Select Option and Parameter
- SAP ABAP Types of Internal Table
- SAP ABAP ways of Declaring Internal Tables
- SAP ABAP Mastering Initialization Technique
- SAP ABAP Operations on Internal Table
- SAP ABAP Record Retrieval
- SAP ABAP Insert, Modify and Delete data in the Internal table by using Keywords
- SAP ABAP Sorting and Removing Adjacent Duplicates
- SAP ABAP Seamless Data Transfer Between Internal Tables
- SAP ABAP Search Help Types
- SAP ABAP Lock Objects and Types
- SAP ABAP Buffering and Its Types
- SAP ABAP TMG
- SAP ABAP Table Types
- SAP ABAP Views
- SAP ABAP Control Break Statement
- SAP ABAP COMMIT and ROLLBACK
- SAP ABAP Joins
- SAP For All Entries
- SAP ABAP Procedure to Fill Final Internal Table
- SAP ABAP Modularization
- SAP ABAP Function Group and Function Module
- SAP ABAP SELECT Options
24DDIC2107 – SAP ABAP Internal Tables: Standard, Sorted and Hashed
Internal tables are a cornerstone of ABAP programming offering powerful tools for data manipulation and processing. There are three primary types of internal tables in ABAP: Standard, Sorted and Hashed. Each type has distinct characteristics and use cases. Let’s explore these in detail.
Standard Internal Table: The Basic Workhorse
Characteristics:
- Accepts Duplicate Records: Standard internal tables allow duplicate entries.
- Non-Unique Fields: All fields can be non-unique.
- Appending Data: Use the APPEND keyword to add data.
- Linear Search: Records are searched using a linear search method.
Syntax:
DATA <Internal Table> LIKE STANDARD TABLE OF <Work Area>.
Example:
DATA IT_STANDARD LIKE STANDARD TABLE OF WA.
Use Case:
Standard internal tables are ideal for general data processing tasks where duplicates are acceptable and a simple sequential access method is sufficient.
Sorted Internal Table: The Sorted Performer
Characteristics:
- Duplicate Records: May or may not accept duplicates based on key definition.
- Key Specification: At least one field must be specified as unique or non-unique.
- Inserting Data: Use the INSERT keyword to add data.
- Binary Search: Utilizes a binary search algorithm for faster searches.
Syntax:
DATA <Internal Table> LIKE SORTED TABLE OF <Work Area> WITH UNIQUE/NON-UNIQUE KEY <Field>.
Example:
DATA IT_SORTED LIKE SORTED TABLE OF WA WITH UNIQUE KEY Eid.
Use Case:
Sorted internal tables are useful for datasets that need to be automatically sorted upon insertion, providing quicker search capabilities than standard tables.
Hashed Internal Table: The Speed Specialist
Characteristics:
- No Duplicate Records: Duplicate entries are not allowed.
- Unique Fields: At least one field must be specified as unique.
- Collecting Data: Use the COLLECT keyword to add data.
- Hash Algorithm Search: Employs a hash algorithm for the fastest search performance.
Syntax:
DATA <Internal Table> LIKE HASHED TABLE OF <Work Area> WITH UNIQUE KEY <Field1> <Field2>.
Example:
DATA IT_HASHED LIKE HASHED TABLE OF WA WITH UNIQUE KEY Eid.
Use Case:
Hashed internal tables are perfect for scenarios where unique records are required and the highest search efficiency is needed.
Making the Right Choice
Choosing the appropriate type of internal table depends on the specific requirements of your application:
Standard Internal Tables are best for basic data processing where duplicates are allowed and simple searches are adequate.
Sorted Internal Tables are advantageous when data needs to be sorted automatically and faster search performance is required.
Hashed Internal Tables are the optimal choice for ensuring unique entries and achieving the quickest search results.
By understanding the characteristics and best use cases of each internal table type ABAP developers can enhance their programs performance and functionality.
Author : Aniket Pawar, 9373518385
24DDIC2107 – SAP ABAP Internal Tables: Standard, Sorted and Hashed
Internal tables are a cornerstone of ABAP programming offering powerful tools for data manipulation and processing. There are three primary types of internal tables in ABAP: Standard, Sorted and Hashed. Each type has distinct characteristics and use cases. Let’s explore these in detail.
Standard Internal Table: The Basic Workhorse
Characteristics:
- Accepts Duplicate Records: Standard internal tables allow duplicate entries.
- Non-Unique Fields: All fields can be non-unique.
- Appending Data: Use the APPEND keyword to add data.
- Linear Search: Records are searched using a linear search method.
Syntax:
DATA <Internal Table> LIKE STANDARD TABLE OF <Work Area>.
Example:
DATA IT_STANDARD LIKE STANDARD TABLE OF WA.
Use Case:
Standard internal tables are ideal for general data processing tasks where duplicates are acceptable and a simple sequential access method is sufficient.
Sorted Internal Table: The Sorted Performer
Characteristics:
- Duplicate Records: May or may not accept duplicates based on key definition.
- Key Specification: At least one field must be specified as unique or non-unique.
- Inserting Data: Use the INSERT keyword to add data.
- Binary Search: Utilizes a binary search algorithm for faster searches.
Syntax:
DATA <Internal Table> LIKE SORTED TABLE OF <Work Area> WITH UNIQUE/NON-UNIQUE KEY <Field>.
Example:
DATA IT_SORTED LIKE SORTED TABLE OF WA WITH UNIQUE KEY Eid.
Use Case:
Sorted internal tables are useful for datasets that need to be automatically sorted upon insertion, providing quicker search capabilities than standard tables.
Hashed Internal Table: The Speed Specialist
Characteristics:
- No Duplicate Records: Duplicate entries are not allowed.
- Unique Fields: At least one field must be specified as unique.
- Collecting Data: Use the COLLECT keyword to add data.
- Hash Algorithm Search: Employs a hash algorithm for the fastest search performance.
Syntax:
DATA <Internal Table> LIKE HASHED TABLE OF <Work Area> WITH UNIQUE KEY <Field1> <Field2>.
Example:
DATA IT_HASHED LIKE HASHED TABLE OF WA WITH UNIQUE KEY Eid.
Use Case:
Hashed internal tables are perfect for scenarios where unique records are required and the highest search efficiency is needed.
Making the Right Choice
Choosing the appropriate type of internal table depends on the specific requirements of your application:
Standard Internal Tables are best for basic data processing where duplicates are allowed and simple searches are adequate.
Sorted Internal Tables are advantageous when data needs to be sorted automatically and faster search performance is required.
Hashed Internal Tables are the optimal choice for ensuring unique entries and achieving the quickest search results.
By understanding the characteristics and best use cases of each internal table type ABAP developers can enhance their programs performance and functionality.
Author : Aniket Pawar, 9373518385