04 - Data Dictionary
04 - Data Dictionary
What is Data Dictionary in SAP? What are main Functions of Data Dictionary in SAP?
The SAP Data Dictionary is a central repository for the development of Objects, SAP Data Dictionary is
used to create and maintain metadata (data definitions). T-Code for Data Dictionary is SE11.
Where DML consists of SELECT, INSERT, UPDATE, MODIFY, DELETE etc, this will be handled by ABAP
Programs and DDL consists of commands like CREATE TABLE, DROP TABLE, ALTER TABLE, CREATE INDEX
etc, this will be handled by Data Dictionary, hence Data Dictionary is the central repository for the
development of objects.
ABAP uses different types of Data Types for Objects, basically there are three types of data types
Elementary Data types, Complex Types, Reference Types.
1. In Elementary types there are again two types of data types (Categories) Fixed Length and
Variable Length.
Fixed Length:
C Text Field
N Numeric
D Date
T Time
H Hexadecimal
P Parked Number
I Integer
F Float
Variable Length
STRING Character Sequence
XSTRING Byte Sequence
Qus: What is the Difference b/w elementary type and reference type?
Ans: Elementary data type are more likely the predefined data type of SAP like C,N,D,T where as
reference data types are the types used for object reference.
For example:
ELEMENTARY TYPE: DATA: LV_VAR TYPE C. (This will store character data)
REFERENCE TYPE: DATA: LV_REF TYPE REF TO ZCL_CLASS CREATE OBJECT LV_REF.
Here ZCL_CLASS is a global class defined in SE24 and LV_REF will be used to call its instance attributes
and methods.
Domain is created.
Go to SE11, select data type radio button, provide a name (ZSAPN_DATAELEMENT) and create.
A relationship which can be defined between tables and must be explicitly defined at field level. Foreign
keys are used to ensure the consistency of data. Data entered should be checked against existing data to
ensure that there are now contradictions. While defining foreign key relationship cardinality has to be
specified. Cardinality mentions how many dependent records or how referenced records are possible.
Buffer
It is a temporary memory for storing the data.
It is same as cache memory.
There are three types of database tables available in SAP, explained below
Transparent table:
There is a physical table on the database for each transparent table. The names of the physical tables
and the logical table definition in the ABAP/4 Dictionary correspond.
All business data and application data are stored in transparent tables.
Pooled table:
Pooled tables can be used to store control data (e.g. screen sequences, program parameters or
temporary data). Several pooled tables can be combined to form a table pool. The table pool
corresponds to a physical table on the database in which all the records of the allocated pooled tables
are stored.
Cluster table:
Cluster tables contain continuous text, for example, documentation. Several cluster tables can be
combined to form a table cluster. Several logical lines of different tables are combined to form a
physical record in this table type. This permits object-by-object storage or object-by-object access. In
order to combine tables in clusters, at least parts of the keys must agree. Several cluster tables are
stored in one corresponding table on the database.
A table can be created in two ways, one is top to bottom approach and another one is bottom to top
approach.
1. Top to Bottom: In this approach, first table fields are defined and later domain and data element
are defined.
2. Bottom to Top: In this approach, first domain and data element are defined and later table will
be created.
In this example we are going to learn creating an SAP transparent table using a top to bottom approach.
Provide short description, delivery class (A), Display Maintenance Allowed and select fields tab.
Select Fields tab, add a field STUDENT_NO, data element as ZSTUDENT_NO and check Key and
Initial Value check boxes.
A table must contain at least one key field, without a key field we can not create a table.
Double click on data element ZSTUDENT_NO (Not yet created), a pop up will open, click yes and
one more information message will come press enter.
Now a pop up will come asking to create date element, click yes.
Similarly create remaining fields with data elements and domains as below
Once all fields are created click on 'Technical Settings' button.
Qus: Can you create a table with fields not referring to data elements?
Ans: Definitely yes, but in that case Data Types should be Elementary. Anyway, this is a bad practice to
do because in that case you won't be able to specify various useful restrictions like Value Range.
How to create a Structure in SAP SE11?
Structure
The structure is a list of fields defined under a name, which is used to process data at run-time in SAP
ABAP applications.
Structures are two types one is global structure and another one is local structure. Local structure can
be created in ABAP programs and global structure can be created in the data dictionary and can be
reusable in different objects.
In this lesson we will be learning how to create  a structure in the data dictionary.
What is the difference between structure and table in SAP data dictionary?
Table and structure have lots of differences in the sense of behavior and properties, the below are the
main differences between tables and structure in the data dictionary.
Table Structure
Tables will store data physically and permanently. Structure cannot store data physically; it can
hold data at run time only.
Tables have primary keys. Structure's does not have any primary key.
Table have technical settings (data class, size category, Structure's does not have any technical
etc), maintenance attributes (Display maintenance attributes and maintenance attributes.
restrictions).
Tables have primary and secondary indexes. A structure does not have primary and
secondary indexes.
What is the difference between Transparent pooled and cluster tables in SAP?
The below are the major differences between transparent, pooled and cluster tables in SAP data
dictionary.
Contain a single table. Used to They are used to hold a large They are used to hold data from a
store master data number of very small tables few number of large tables.(stores
(stores system data). system data).
For each transparent table there is It is stored with other pooled Many cluster tables are stored in a
one associated table in the tables in a single table called table single table in the database called a
database. pool in the database. table cluster.
The database table has the same The database table has different The database table has different
name, same number of fields and name, different number of fields name, different number of fields
the fields have the same names. and fields have different names. and fields have different names.
There is only a single table. Table pools contain more tables Contains less tables than table
than table clusters. pools.
Secondary indexes can be created. Secondary indexes cannot be Secondary indexes cannot be
created. created.
Go to SE11, provide table name as ZSTUDENT_TABLE ( which we have created already in our
previous lessons, if not create a table )
Go to tab Entry help/check, select city fields and click on 'Foreign key' icon.
Provide short text, check table name ZSTUDENT_CHECK and click on 'Generate Proposal' and
click on copy.
A Check table will be assigned to CITY field
Save and activate the table (If you get a warning popup when activating just press no).
Now go to utilities - table entries -> create entries
Provide a city name which is not in ZSTUDENT_CHECK table and try to save, it will trough an
error.
Fixed values of a domain in SAP
SAP Table screen entries can be restricted using domain fixed values, we can maintain domain fixed
values at domain level when creating a domain.
Provide short description, data type and length as below and click on value range tab.
Provide fixed values.
Go to SE11, provide a table name ZSTUDENT_TABLE(we have already created, if not create table)
and click on change
Go to fields tab and add a field as below.
11. What Is The Difference Between Check Table And Value Table?
CHECK TABLE:
A foreign key links two tables T1 and T2 by assigning fields of table T1 to the primary key fields of
table T2.
Table T2 is then known as the check table of the foreign key.
VALUE TABLE:
Sometimes when you define a domain, you already know that all fields that use the domain will
need to be checked against a particular table. You can store this information in the domain
definition by specifying a value table.
If you try to define a foreign key for a field that points to this domain, the value table of the
domain is proposed as the check table for the foreign key.
12. What Are The Differences Between Cluster Tables And Pooled Tables?
Cluster tables: Table type in the ABAP Dictionary.
The data of several cluster tables is stored together in a single table cluster in the database. A
cluster table is thus known only in the ABAP Dictionary, not in the database.
14. What is the difference between Master data and Transaction data in SAP?
Master data is data that does not change often and is always needed in the same way by business.
Ex: One time activities like creating Company Codes, Materials, Vendors, Customers etc.
Transaction data keeps on changing and deals with day to day activities carried out in business.
Transactions done by or with Customers, Vendors, and Materials etc. generate Transaction Data.
So data related to Sales, Purchases, Deliveries, Invoices etc. represent transaction data.
22. Can you delete a domain, which is being used by data elements?
No, when we try to do it will through an error
32. Can we have the same append structure in more than one Database Table?
No, you cannot have same append structure in more than one database table.