6 Columns with Active Background
Active List Item Background

24DDIC1307 – Exploring Different Database Tables and Views in SAP ABAP

In the world of SAP ABAP (Advanced Business Application Programming), database tables form the backbone of data storage and management. Different types of tables are designed to meet various data storage needs and optimize performance. In this blog, we will explore the distinct types of database tables in SAP ABAP shedding light on their unique characteristics and use case.

There are mainly three types of Database tables:

  1. Transparent Tables

Transparent tables are the most fundamental type of table in SAP. Each transparent table in the ABAP Data Dictionary corresponds to a single table in the underlying database.

  • Characteristics:

One-to-One Mapping: The structure of a transparent table in the ABAP Dictionary is identical to its structure in the database.

Direct Storage: Data is stored directly within the table.

Flexible Use: Ideal for storing master data (e.g. customer, material) and transactional data (e.g., sales orders, purchase orders).

Use Case: Transparent tables are extensively used in various SAP modules for core business data. For instance the MARA table which holds material master data is a classic example.

Example:

ABAP

TABLES: mara.

SELECT * FROM mara INTO TABLE lt_mara.

 

  1. Pool Tables

Pool tables also known as pooled tables are logical tables that are combined into a single physical table in the database called a table pool.

Characteristics:

Logical-Physical Mapping: Multiple logical tables map to one physical table in the database.

Space Efficiency: Suitable for storing numerous small tables with similar structures reducing database storage space.

Control Data: Often used to store control and configuration data that do not require frequent access.

Use Case: Pool tables are optimal for storing small and static control data. For example, various customizing tables are often stored in pools.

Example:

ABAP

SELECT * FROM t000 INTO TABLE lt_t000.

 

Note: T000 is an example of a pooled table storing client information. Pooled tables are ideal when you need to fetch large amount of data from fewer fields. Joins are not possible with pooled table.

  1. Cluster Tables

Cluster tables are a type of table where multiple logical tables are grouped into a single physical table called a table cluster.

  • Characteristics:

Combined Storage: Related tables are stored together, which optimizes performance for read operations.

Complex Relationships: Suitable for tables with foreign key relationships, which are often accessed together.

Control and Transaction Date: Commonly used for control data and certain transactional data that are processed together.

Use Case: Cluster tables are particularly useful in accounting and financial applications. For example, the BSEG table (accounting document segment) is stored within a cluster table.

Example:

ABAP

SELECT * FROM bseg INTO TABLE lt_bseg.

 

Note: Buffering is not feasible form a clustered table that’s the reason fetching data from clustered table can take more time.

 

  1. Views

Views in SAP are virtual tables that provide a specific view of data from one or more tables without storing the data themselves.

  • Characteristics:

No Physical Storage: Views do not store data physically; they merely present it.

Simplified Access: Useful for providing simplified and specific access to data.

Types of Views:

Database Views: Join multiple tables at the database level.

Projection Views: Restrict fields from a single table.

Help Views: Facilitate search helps by combining data from multiple tables.

Maintenance Views: Enable data maintenance for related tables through a single interface.

Use Case: Views are used to streamline data access and enhance performance. For instance a view might be created to present a subset of fields from a large table for reporting purposes.

Example:

ABAP

DATA: lt_view TYPE TABLE OF view_name.

SELECT * FROM view_name INTO TABLE lt_view.

 

  1. Global Temporary Tables

Global Temporary Tables (GTTs) are temporary tables used during the runtime of an application for storing intermediate results.

  • Characteristics:

Temporary Storage: Data is stored temporarily and is cleared at the end of the session or after a specified event.

Session-Specific: The data in these tables is session-specific meaning it is not accessible beyond the current session.

Use Case: GTTs are useful for complex calculations and temporary data manipulation during program execution.

Example:

ABAP

CREATE GLOBAL TEMPORARY TABLE gtt_example AS (SELECT * FROM some_table WHERE condition);

 

Author : Aniket Pawar, 9373518385                             

6 Columns with Active Background

24DDIC1307 – Exploring Different Database Tables and Views in SAP ABAP

In the world of SAP ABAP (Advanced Business Application Programming), database tables form the backbone of data storage and management. Different types of tables are designed to meet various data storage needs and optimize performance. In this blog, we will explore the distinct types of database tables in SAP ABAP shedding light on their unique characteristics and use case.

There are mainly three types of Database tables:

  1. Transparent Tables

Transparent tables are the most fundamental type of table in SAP. Each transparent table in the ABAP Data Dictionary corresponds to a single table in the underlying database.

  • Characteristics:

One-to-One Mapping: The structure of a transparent table in the ABAP Dictionary is identical to its structure in the database.

Direct Storage: Data is stored directly within the table.

Flexible Use: Ideal for storing master data (e.g. customer, material) and transactional data (e.g., sales orders, purchase orders).

Use Case: Transparent tables are extensively used in various SAP modules for core business data. For instance the MARA table which holds material master data is a classic example.

Example:

ABAP

TABLES: mara.

SELECT * FROM mara INTO TABLE lt_mara.

 

  1. Pool Tables

Pool tables also known as pooled tables are logical tables that are combined into a single physical table in the database called a table pool.

Characteristics:

Logical-Physical Mapping: Multiple logical tables map to one physical table in the database.

Space Efficiency: Suitable for storing numerous small tables with similar structures reducing database storage space.

Control Data: Often used to store control and configuration data that do not require frequent access.

Use Case: Pool tables are optimal for storing small and static control data. For example, various customizing tables are often stored in pools.

Example:

ABAP

SELECT * FROM t000 INTO TABLE lt_t000.

 

Note: T000 is an example of a pooled table storing client information. Pooled tables are ideal when you need to fetch large amount of data from fewer fields. Joins are not possible with pooled table.

  1. Cluster Tables

Cluster tables are a type of table where multiple logical tables are grouped into a single physical table called a table cluster.

  • Characteristics:

Combined Storage: Related tables are stored together, which optimizes performance for read operations.

Complex Relationships: Suitable for tables with foreign key relationships, which are often accessed together.

Control and Transaction Date: Commonly used for control data and certain transactional data that are processed together.

Use Case: Cluster tables are particularly useful in accounting and financial applications. For example, the BSEG table (accounting document segment) is stored within a cluster table.

Example:

ABAP

SELECT * FROM bseg INTO TABLE lt_bseg.

 

Note: Buffering is not feasible form a clustered table that’s the reason fetching data from clustered table can take more time.

 

  1. Views

Views in SAP are virtual tables that provide a specific view of data from one or more tables without storing the data themselves.

  • Characteristics:

No Physical Storage: Views do not store data physically; they merely present it.

Simplified Access: Useful for providing simplified and specific access to data.

Types of Views:

Database Views: Join multiple tables at the database level.

Projection Views: Restrict fields from a single table.

Help Views: Facilitate search helps by combining data from multiple tables.

Maintenance Views: Enable data maintenance for related tables through a single interface.

Use Case: Views are used to streamline data access and enhance performance. For instance a view might be created to present a subset of fields from a large table for reporting purposes.

Example:

ABAP

DATA: lt_view TYPE TABLE OF view_name.

SELECT * FROM view_name INTO TABLE lt_view.

 

  1. Global Temporary Tables

Global Temporary Tables (GTTs) are temporary tables used during the runtime of an application for storing intermediate results.

  • Characteristics:

Temporary Storage: Data is stored temporarily and is cleared at the end of the session or after a specified event.

Session-Specific: The data in these tables is session-specific meaning it is not accessible beyond the current session.

Use Case: GTTs are useful for complex calculations and temporary data manipulation during program execution.

Example:

ABAP

CREATE GLOBAL TEMPORARY TABLE gtt_example AS (SELECT * FROM some_table WHERE condition);

 

Author : Aniket Pawar, 9373518385