Types Of Tables In SAP - Transparent, Pooled & Cluster Tables
There are 3 types of tables in SAP Dictionary (DDIC). They are:
- Transparent Table
- Pooled Table
- Cluster Table
TRANSPARENT TABLES:
Whenever a table is created and defined through ABAP Dictionary, then it is called a transparent table. When the table is activated in ABAP Dictionary, a table automatically gets created in the underlying database with the same name as was defined in ABAP Dictionary.
So generally we say, transparent tables has one to one relationship with underlying database which means there will be only one physical table on the database for each transparent table created and defined through ABAP Dictionary.
The names of the table and fields in underlying database will correspond or have the same names as the logical table definition in the ABAP Dictionary.
Transparent tables can be used to store application data which include master data as well as transaction data. Transparent tables are probably the only type of table that you will ever create as a developer.
POOLED TABLES
Tables in Data dictionary which has many to one relationship with an underlying database table is called Pooled table. In simple words, Pooled tables appear as many tables in ABAP dictionary, but the thing is they are stored as a single table in the underlying database.
In ABAP Dictionary, you can see each and every pooled table is assigned to a Table Pool.
As it is understood that for many pooled tables in ABAP dictionary, there is a single table called as Table Pool in an underlying database. A Table Pool is an underlying database table with a special structure that enables the data of many ABAP Dictionary tables to be stored within it.
Tables M_MTVMA, M_MTVMB, M_MTVMC, M_MTVMD and M_MTVME can be seen in ABAP Dictionary. The se all mentioned tables are Pooled Tables. All these tables have been assigned to one Table Pool i.e. M_MTVM, which will be present in the underlying database and storing data of all the five mentioned tables of ABAP Dictionary.
Pooled tables are basically used by SAP to store temporary data or customizing data. Pooled tables can also be used to store control data (such as screen sequences or program parameters).
Generally as a developer, we will never create a Pooled table or Table Pool. It does not mean that we cannot create them. SAP has given the option to create Pooled tables through SE80 transaction and Table pool via ABAP Dictionary.
CLUSTER TABLE
A cluster table is similar to a Pooled table. It has a many to one relationship with a table in an underlying database. Many cluster tables are stored in a single table in an underlying database called a table cluster.
So table cluster is similar to pooled table pool. A table cluster holds only cluster table within it.
Table clusters store data from several cluster tables based on the primary key fields that they have in common.
Rows from the cluster tables are combined into a single row in the table cluster. The rows are combined based on the part of the primary key they have in common.
The biggest advantage of cluster table and pooled table is they reduce the number of database reads and thereby improve performance.
Tables CDPOS is a Cluster table in SAP ABAP Dictionary and CDCLS is the table cluster that exist in the underlying database. CDCLS table contains or hold data of both tables CDPOS and CDHDR in the underlying database.
DIFFERENCE BETWEEN TRANSPARENT, POOLED & CLUSTER TABLES
- Transparent tables have a one to one relationship with a physical table in an underlying database where as pooled tables and cluster tables have many to one relationship with a physical table in the underlying database (Relationship between tables in ABAP Dictionary & Underlying database).
- In case of transparent tables, the underlying database table will have the same name, same number of fields and the fields will also have the same names as defined in ABAP Dictionary whereas for pooled tables and cluster tables the underlying database table will have different name, different number of fields and fields will have different names from what has been defined in ABAP Dictionary.
- Transparent tables can have one or more primary key Whereas Primary key of each pooled table of a table pool need not be same whereas Primary key of each cluster table of a table cluster should have at least one key in common.
- Secondary indexes can be created for transparent tables, but for pooled and cluster tables we cannot create any secondary index.
- Transparent tables can be accessed via both Native and Open SQL whereas pooled and cluster table can be accessed by Open SQL only.
- Transparent tables are used to hold application data which includes both master data as well as transaction data. Pooled tables reduce the amount of database resources needed when many small tables have to be opened at the same time. Cluster tables are used when the tables have primary key in common and data in these tables are all accessed simultaneously.