data dictionary
TRANSCRIPT
Data Dictionary
What is Data Dictionary
is a system independent interface to the database
is a virtual database ( data about data)
provides data for data manipulation and data processing
Also called as DDIC and ABAP Dictionary
The T-Code for DDIC is SE-11.
DDIC(SE-11)
Transparent Table. A transparent table in the dictionary has a
one-to-one relationship with a table in the database.
Its structure in R/3 Data Dictionary corresponds to a single database table. Has one to one relationship with a Db table. Used to hold application data or master
data used by application. Has the same name and fields as the Db
table.
POOLED TABLES (small tables like VIEWS) that holds
customizing data from many database tables and they have many-to-one relationship with a database table . For one database table, there are many tables in the dictionary ( with different table name; different field names and different number of fields). Each pooled table contains table description.
Pooled Tables (contd..) Many pooled tables are stored together in
a database table called a table pool which holds system data. You create table defiition for a table pool. When activated, an associated single table will be created in the database. Then you can defines pooled tables and assign the pooled tables to the table pool.
Cluster Table
Holds data from a few very large tables (like joining tables on common part of primary key). It has many-to-one relationship with a database table. Many clustered tables are stored in a single database table called a table cluster.
(Pooled tables and clustered tables are usually used only by SAP)
DDIC Domains and data elements are
reusable. A domain can be used in more than one data element, and a data element can be used in more than one field and in more than one table.
DDIC
Naming conventions Custom fields, data elements and
domains must start with Y or Z. All names are a maximum of 10
characters long.
SAP Table Creation Attributes Data Class – Physical area in the database where
tables will be stored.
Size category – Size of extents to be reserved when table is activated.
Buffering – Data in the database tables will be stored in application server buffers for better performance.
(Cluster tables cannot be buffered)
Buffering Methods
SAP R/3 allows three modes of buffering.
1) Full Buffering Full – All the records of the table are loaded into the
buffer when one record of the table is read.
NOTE: Use full buffering if tables up to 30 KB in size. If a table is
accessed frequently, but all accesses are read accesses
Buffering Methods 2) Generic Buffering With generic buffering, all the records in the buffer
whose generic key fields match this record are loaded when one record of the table is accessed
NOTE : Only 64 bytes of the generic key are used. You can
specify a longer generic key, but the part of the key exceeding 64 bytes is not used to create the generic areas.
Buffering Methods 3) Single Buffering With single-record buffering, only the records
that are actually read are loaded into the buffer.
NOTE: Single-record buffering should be used
particularly for large tables where only a few records are accessed with SELECT SINGLE. The size of the records being accessed should be between 100 and 200 KB.
When buffers are bypassed? The following accesses always bypass the
buffer and proceed directly to the database:
SELECT... BYPASSING BUFFER SELECT FOR UPDATE SELECT with aggregate function, for example
COUNT, MIN, MAX, SUM, AVG SELECT DISTINCT SELECT... WHERE… IS NULL ORDER BY (with the exception of PRIMARY
KEY)
Logging
Each change to an existing data record ( update or delete ) by the user is recorded in a log table (DBTABPRT).
Pre-requisites User profile must contain rec/client
Logging .. Contd
Run transaction SCU3 to display table change history.
DDLOG sap table contain central log information for buffering.
Creating data dictionary objects
SAP Repository Transaction SE11.
Domain
Data Element
Table
DDIC Application Data Transaction SE16. Displays the contents of a table.
Database Index
Consider Index as database table with certain fields in sorted fashion using binary search.
Primary index created during table creation. Other than primary index, indexes you create
are called secondary index. Several indexes on the same table is identified
by index identifier ( 3 character code which identifies index).
Foreign Keys A foreign key is a field in a table that is
connected to another table via a foreign key relationship .
The purpose of the foreign key relationship is to validate the data being entered into one table by checking against a valid set of values in another table.
Cont.. You can define the relationships
between tables in the ABAP Dictionary by creating foreign keys.
Using foreign keys, you can easily create value checks for input fields. Foreign keys can also be used to link several tables in a view or a lock object.
Types of Foreign key Fields No key fields/candidates: The foreign key fields are
neither primary key fields of the foreign key table nor do they uniquely identify a record of the foreign key table (key candidates).
Key fields/candidates: The foreign key fields are either primary key fields of the foreign key table or they already uniquely identify a record of the foreign key table (key candidates).
Key fields of a text table: The foreign key table is a text table for the check table, that is the key of the foreign key table only differs from the key of the check table in that it has an additional language key field.
How Foreign Key Works?
A SELECT statement is generated from the definition of the foreign key. If an entry is made in the check field, this SELECT statement is submitted. If a suitable record of the check table is found, the entry is valid. Otherwise the entry is rejected.
Triggering the Foreign Key Check Foreign key checking is performed by
the R/3 user interface. Foreign Keys are checked at the
application layer or at the user interface level.
Formulated by a SELECT statement behind the scenes.
Requirements To create a foreign key:
The check must occur against a field within the primary key of the check table.
The domain names for the foreign key field and the check table field must be the same.
Compound Foreign Keys A compound foreign key is a foreign key
composed of two or more fields.
text table
A text table is a table that contains spoken-language descriptions of values in a check table
Modifying SAP tables SAP tables can be modified using two
methods
1) Append structures 2) CI Includes
Append Structures Append structures are used for enhancements
that are not included in the standard. This includes special developments, country versions and adding customer fields to any tables.
An append structure is a structure that is assigned to exactly one table. There can be more than one append structure for a table.
Customer Includes A Customizing include is a structure that
satisfies a special naming convention. The name of a Customizing include begins with ‘CI_’ and the include lies in the customer namespace.
A Customizing include can be contained in several tables or structures, so that they remain consistent when the include is modified.
SAP Module wise table View
SAP Finance Tables BKPF - Accounting document header BSEG - Accounting document segment BSEC - One-time a/c data doc segment BSET - Tax data document segment BSAD - Customers cleared items index table BSID - Customers open items index table BSIS - Glcode open items index table BSIK - Vendors open items index table
SAP Controlling Tables COSP - (Cost Totals – External Posting) COEP - (Period related line items) COBK - (Controlling header table) GLPCC – (EC-PCA Transaction Attributes) GLPCO – (EC-PCA A/c Assignment
Elements) GLPCA – (EC-PCA Actual Line Items) GLPCT – (EC-PCA Totals Table)
SAP Materials Tables MARA – Material Master (General) MAKT – Material Description MARA – Material Master (C segment) MARM – Units of Measure MBEW – Materials Valuation EKKO – Purchase document header EKPO – Purchase document Item EKET – Delivery Schedules EKKN – A/c Assignment in PO document
SAP Project Planning tables PROJ - Project definition PRPS - WBS Elements PRTX - WBS (Texts) PSTX - Project texts header PRTE – Schedule data project items PRHIS – Project Hierarchy for WBS
SAP Sales & Distribution tables VBAK - Sales document : Header VBAP - Sales document : Item Info VBEP - Sales document : Schedule lines VBPA – Sales document : Partner VBFA – Sales document : Flow VBKD – Sales document Business data VBRK - Billing document Header VBRP – Billing document Items VBUK – Sales document Header status
VIEWS
Views The data of a view is derived from one
or more tables, but not stored physically.
Data that can be selected with a view depends primarily on whether the view implements inner join or outer join.
Types of Views
SAP R/3 supports four types of Views
1) Database View 2) Projection View 3) Help View 4) Maintenance View
Database View A database view provides an application-
specific view on such distributed data.
If the database view only contains a single table, the maintenance status can be used to determine if data records can also be inserted with the view. If the database view contains more than one table, you can only read the data.
Project View A project view contains exactly one
table. You cannot define selection conditions
for selection views. Project views are used when you
required to use only few selected fields in your view.
Help view You have to create a help view if a view
with outer join is needed as selection of a search help.
Only foreign keys that have certain attributes can be used here.
Maintenance View A maintenace view permits you to
maintain the data of an application object together.
Only those tables that are linked with the primary table (indirectly with a foreign key can be included in the maintenance view).
Search Helps
How Search Help works?1. The user starts the input help to display the
possible input values for a field.2. The system offers the user a number of possible
search paths3. The user enters restrictions if required and then
starts the search.4. The system determines the values that satisfy
the entered restrictions (hits) and displays them.5. The user selects the most suitable line from the
hit list by double-clicking
Search Helps Selection method to limit data records
used in table selection. Allows you to include to field input help. In R/3 you can create two types of
search helps. 1) Elementary Search help 2) Collective search help
Elementary Search Help Where does the data displayed in the hit list
come from (selection method) what information should be displayed in the
dialog box for value selection and in the hit list (search help parameters)
what field contents can be taken into account for hit list selection (search help parameters).
what dialog steps should be executed in the input help (dialog behaviour)
Collective Search Help A collective search help combines several
elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
Lock Objects
Lock Objects
The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules. These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.
Lock Objects Activating a lock object in the ABAP Dictionary
automatically creates function modules for setting (ENQUEUE_<lock object name>) and releasing (DEQUEUE_<lock object name>) locks.
The generated function modules are automatically assigned to function groups. You should not change these function modules and their assignment to function groups since the function modules are generated again each time the lock object is activated.
Parameters of Lock Object Field names of the lock object _SCOPE ( how lock and unlock must work) Lock Mode _WAIT (determines the lock behaviour when
there is a lock conflict ).
Exceptions of theENQUEUE Function Module
FOREIGN_LOCK: A competing lock already exists. You can find out the name of the user holding the lock by looking at system variable SY-MSGV1.
SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case, the lock could not be set.
Questions Please
THANKS