0% found this document useful (0 votes)
252 views28 pages

04 - Data Dictionary

The document discusses the SAP data dictionary, which is a central repository for metadata like database tables, views, data elements, and domains. It defines the data dictionary's main functions and describes how an ABAP consultant may work with objects in the data dictionary like creating tables, data elements, domains, and views. It also provides information on data types in ABAP, how to create domains and data elements, and the components and types of database tables in SAP.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
252 views28 pages

04 - Data Dictionary

The document discusses the SAP data dictionary, which is a central repository for metadata like database tables, views, data elements, and domains. It defines the data dictionary's main functions and describes how an ABAP consultant may work with objects in the data dictionary like creating tables, data elements, domains, and views. It also provides information on data types in ABAP, how to create domains and data elements, and the components and types of database tables in SAP.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

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.

SQL Can be divided into two parts


 DML -- Data Manipulation Language
 DDL -- Data Definition Language

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.

The Main Functions of Data Dictionary are:


 Data Base Tables
 Views
 Data Elements
 Domains
 Structures
 Search Helps
 Lock Objects

An ABAP Consultant may need to work on below areas of data dictionary:


 Creating Tables
 Creating Data elements and Domains
 Creating structures and Table types
 Creating search helps
 Creating Lock objects
 Creating data base views

Data Types Domains Data Elements in SAP

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

Complex Types includes Structure Types and Table Types.

Reference Types includes Data References and Object References

What is a Date Element in SAP ABAP?


Data element is an object which specified semantic information of a field.
Ex: field label, heading.
(We all know that table is a collection of fields, ex: STUDENT is a table with fields STUDENT_ID,
STUDENT_NAME etc, data element specifies the field labels and headings for these fields)

What is a Domain in SAP ABAP?


Domain is an object which specified technical information of a field in a table.

Ex: Data type, length, value range etc

Why we use Data elements and Domains in SAP?


Whenever we are creating a new table or adding a field to existing table, we need to specify field labels
and data types for the field; in SAP we maintain these values in the form of Data elements and Domains.

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.

How to create Domain and Data Element in SAP?

How to create Domain in SAP


Creating a Domain in SAP
 Go to SE11 T-code, select domain radio button, provide a name (ZSAPN_DOMAIN) and create.
 Provide short description, no of characters and save (Ctrl S).

 Select local object (non transportable object).


 Activate.

Domain is created.

How to create Data Element in SAP


Creating data element in SAP

 Go to SE11, select data type radio button, provide a name (ZSAPN_DATAELEMENT) and create.

A popup will open, select data element radio button


 Enter short description and domain name (ZSAPN_DOMAIN) and select field label tab.

 Select field label tab and maintain field labels.

 Save and Activate, Data element is created.


What are the components of SAP Tables SE11?

What are the components of Table in SAP?


Before creating a table, we must know the components of the table.

What is a key field in ABAP Dictionary Table?


A field which does not accept duplicate data is called as the key field.

What is a foreign Key in ABAP Dictionary


Foreign Key is a concept which is used to define relations between tables in ABAP Dictionary.

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.

What is Compound Foreign Key in ABAP Dictionary?


A compound foreign key is a foreign key composed of two or more fields. In other words, a check is
done to compare two fields in the foreign key table against two fields in the check table. The
combination of values must exist in the check table before they can be inserted into the foreign key
table. However only one field on the screen will trigger the compound foreign key check.

What is a Delivery Class in ABAP Dictionary?


It specifies the type of data stored in a database table ex: master data, Transaction data, system data
etc.

Options available under delivery class:


 A - Application Table (Master and Transaction data).
 C - Customizing table, maintenance only by customer not SAP.
 L - Table for storing temporary data.
 G, E, S, W - These are used to store system data (Basis data).

Display and Maintenance


It specifies whether the user can display the data and maintain the data, the following options are
available under display and maintenance.

 Display/Maintenance Allowed. - User can display and maintain data.


 Display/Maintenance allowed with restrictions - Some users can display and maintain data.
 Display/Maintenance not allowed - No user can display data.

What is data class?


It specifies the physical area of a table in the database; the following options are available under data
class.
 APPL0 - Master data
 APPL1 - Transaction data
 APPL2 - Organization and Customizing
 DDIM, DFACT, DODS etc., it is used by BI and BW.
What is size category in Data Dictionary?
It specifies the numbers of records that can be stored in a database table, options available under size
category are below.

Size Category No of expected records


0 0 - 7,100
1 7,100 - 28,000
2 28,000 - 1,10,000
 The above numbers may vary from company to company.
 Size category will be incremented dynamically based on increase in records.

Buffer
 It is a temporary memory for storing the data.
 It is same as cache memory.

Qus: What are types of buffering?


Ans: Types of buffering are: Single record buffering, Generic area buffering & Fully buffered

What are the types of database tables in SAP?

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.

How to create a database table in SAP SE11?

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.

 Go to SE11 T-code, provide table name to be created ZSTUDENT_TABLE and create.

 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.

 Provide short description, domain and label


 Save, double click on domain name ZSTUDENT_NO, click on yes.
 Provide short description, data type, no. Characters, save and activate.

 Similarly create remaining fields with data elements and domains as below
 Once all fields are created click on 'Technical Settings' button.

 Provide data class and size category, save and activate.


 You will get a warning message just click on No, table is created.
 Now add entries to table.

 After entry completed, click on Save.

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.

 Go to SE11, select Data Type radio button and click on create.

 A pop up will open, select structure radio button and continue.

 Provide short description, add some fields, save and activate.


The structure is created, now we can use this structure in our ABAP programs.

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 and Structure Difference

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.

Transparent Tables Pool Tables Cluster Tables

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).

It has a one-to-one relationship It has a many-to-one relationship It has a many-to-one relationship


with a table in the database. with a table in the database. with table in the database.

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.

What is a Check table? How to create a check table in SAP?

What are table validations?


Table validation is a concept through which we can restrict invalid entries in a table.

Possible methods/concepts for table validation


1. Field Level validations: We can validate entries at field level with the help of check table concept.
2. Domain level validations: We can restrict entries at the domain level with the help of fixed values
of the domain and value table of the domain.

What is a check table?


It is a table which contains all valid entries of a field.

What is value table?


It is a table which contains all valid entries of a domain; this domain can be reused in multiple tables.

What are fixed values for the domain?


These are allowed values for a domain ex: GENDER (domain).
Creating check table for table validations.

Step1: Go to SE11; create a table ZSTUDENT_CHECK as below

 Go to SE11, provide name as ZSTUDENT_CHECK and click on create.

 Provide delivery class and display maintenance allowed.

 Go to fields tab and add a field as below


 Click on technical settings button and provide data class and size category.
 Go to utilities- table contents - create entries add some entries to the table.

 Similarly add some more entries.

Step2: Add ZSTUDENT_CHECK as check table for ZSTUDENT_TABLE

 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.

Create domain with fixed values


 Go to SE11, select domain, provide name as ZGENDER, click on create.

 Provide short description, data type and length as below and click on value range tab.
 Provide fixed values.

 Save and activate.

Create data element with domain

 Go to SE11, select data type, provide name as ZGENDER, click on create.

 A popup will come, select data element and press enter.


 Provide short description, domain and click on field label.

 Provide field labels

 Save and activate

Add a field in table

 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.

 Save and activate


 Go to table utilities- table entries - create entries

 Provide values other than M, F and N, it will through an error.


SAP Interview Questions

1. What is an ABAP data dictionary?


ABAP/4 data dictionary describes the logical structures of the objects used in application
development and shows how they are mapped to the underlying relational database in
tables/views.

2. What are domains and data element?


Domains: Domain is the central object for describing the technical characteristics of an attribute of
a business objects. It describes the value range of the field.
Data Element: It is used to describe the semantic definition of the table fields like description the
field. Data element describes how a field can be displayed to end-user.

3. What is foreign key relationship?


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.

4. Describe data classes in SAP?


Master data: It is the data which is seldomly changed.
Transaction data: It is the data which is often changed.
Organization data: It is a customizing data which is entered in the system when the system is
configured and is then rarely changed.
System data: It is the data which R/3 system needs for itself.

5. What are indexes in SAP tables?


Indexes are described as a copy of a database table reduced to specific fields. This data exists in
sorted form. These sorting forms ease fast access to the field of the tables. In order that other
fields are also read, pointers to the associated record of the actual table are included in the index.
The indexes are activated along with the table and are created automatically with it in the
database.

6. Difference between transparent tables and pooled tables?


Transparent tables: A transparent table in the dictionary has a one-to-one relation with the table
in database. Its structure corresponds to single database field. Table in the database has the same
name as in the dictionary. Transparent table holds application data.
Pooled tables: A pooled table in the dictionary has a many-to-one relation with the table in
database. Table in the database has the different name as in the dictionary. Pooled table are
stored in table pool at the database level.
7. Difference between .include and .append?
Include structure allows to add one or more structure into structure or table. Also placed
positioning anywhere. Up to 6 include structure can be used in a table.
Append structure can be placed only at the end of a structure or table which also stops further
insertion of fields. Only one append structure can be used.

8. What is occurs in internal table?


Occurs addition to the Declaration will give initial size to that table. occur statement allocates 8kb
of memory to the internal table.

9. Buffering concept usage in SAP Tables?


There are three type of buffer
1. Single record
2. Generic buffer
3. Full buffer
Buffering is use for improve performance. it improves performance 10 to 100 times more

10. What is occurs in internal table?


Occurs addition to the Declaration will give initial size to that table. Occur statement allocates 8kb
of memory to the internal table.

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.

Pooled tables: Table type in the ABAP Dictionary.


The data of several pooled tables are stored together as a table pool in the database. Therefore, a
pooled table is known in the ABAP Dictionary, but not in the database.
13. What is the difference between VIEW and a TABLE in SAP?
A Table physically stores data.
A View does not store any data on its own. It can contain data from multiple tables and it just
accesses/reads data from those tables.

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.

Some important transactions here for Master Data:


 Material: MM01 MM02 MM03.
 Vendor: XK01 , XK02 , XK03
 Customer: Xd01 , XD02 , XD03.

Some Important transactions for Transaction data:


 Purchase Order: ME21n , ME22n , ME23n.
 Sales Order: VA01 , VA02 , VA03.
 Goods Receipt: MIGO.
 Invoices: MIRO.
15. Can a domain, assigned to a data element be changed?
Yes, it can be changed. We can do it by just overwriting the entry in the field domain.

16. What is a Data Class in SAP Data Dictionary?


Data class determined the physical area of table inside database; it is available under technical
settings of table in Se11... Example: APPL0, APPL1 etc

17. What is a Size Category in SAP Data Dictionary?


The Size category describes the probable space requirement of the table in the database.

18. What are the Data types of the ABAP/4 layer?


Possible ABAP/4 data types:
C: Character.
D: Date, format YYYYMMDD.
F: Floating-point number in DOUBLE PRECISION (8 bytes).
I: Integer.
N: Numerical character string of arbitrary length.
P: Amount of counter field (packed; implementation depends on h/w platform).
S: Time Stamp YYYYMMDDHHMMSS.
V: Character string of variable length, length is given in the first two bytes.
X: Hexadecimal (binary) storage.
19. What are two methods of modifying SAP standard tables?
1. Append Structures and
2. Customizing Includes.
20. To how many tables can an append structure be assigned?
Only one; Append structure cannot be reusable; we cannot use it for multiple tables.

21. What is a Match Code in SAP Data Dictionary?


Match code is a tool to help us to search for data records in the system. Match Codes are an
efficient and user-friendly search aid where key of a record is unknown.

22. Can you delete a domain, which is being used by data elements?
No, when we try to do it will through an error

23. What is the function of a Domain in SAP Data Dictionary?


 A domain describes the technical settings of a table field.
 A domain defines a value range, which sets the permissible data values for the fields, which
refers to this domain.
 A single domain can be used as basis for any number of fields that are identical in structure.
24. Can you delete data element, which is being used by table fields.
No, we cannot delete data element which is being used by table fields.

25. What is a table pool in SAP?


Table pool (or pool) is used to combine several logical tables in the ABAP/4 Dictionary. The
definition of a pool consists of at least two key fields and a long argument field (VARDATA).

26. What is the difference between Structure and work area?


Structure and Work area have same functionality but structure is defined in data dictionary and
can be used in both program level and data dictionary, work area can only be used in program.

27. How data is stored in cluster table?


Each field of cluster table behaves as tables which contains the no. of entries.

28. What are client dependant objects in abap/sap?


SAP Script layout, text element, and some DDIC objects.

29. Can we create field without data element and how?


In SE11 one option is available above the fields strip. Data element/ direct type.

30. How can I copy a standard table to make my own z_table.


Go to transaction SE11. Then there is one option to copy table. Press that button. Enter the name
of the standard table and in the Target table enter Z table name and press enter.

31. What are the difference between Table and Structure?


The major difference is, the Data Base tables hold the physical data where as Structures doesn't
hold any data.

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.

You might also like