SAP Data Dictionary
SAP Data Dictionary
Data definitions (metadata) are created and managed in the ABAP Dictionary. The ABAP Dictionary permits a central description of all the data used in the system without redundancies. New or modified information is automatically provided for all the system components. This ensures data integrity, data consistency and data security.
I will be showing the steps to create Different Kinds of Tables, Structures, Views, Lock Objects, and Search Helps. In Sort lets explore SE11. Tables: Tables are defined in the ABAP Dictionary independently of the database. A table having the same structure is then created from this table definition in the underlying database. a. Transparent Table
Exists with the same structure both in dictionary as well as in database exactly with the same data and fields. One-to-one relationship with a table in the database. Can be accessed using open and native SQL.
By Debesh
Page 1
Data Dictionary
By Debesh
Page 2
Data Dictionary
Delivery Class: It controls the extent to which SAP or the customer is responsible for table maintenance.
It controls the transport of table data for an installation, upgrade, or client copy and transports between customer systems.
By Debesh
Page 3
Data Dictionary
Data element and Domain: Domain specifies the technical attributes of a data element i.e. its data type, length, possible values, and appearance on the screen. Each data element has an underlying domain.
A single domain can be the basis for several data elements. Domains are objects in the ABAP Dictionary. Data Element describes the business function of a table field. Its technical attributes are based on a domain, and its business function is described by its field labels and documentation.
By Debesh
Page 4
Data Dictionary
By Debesh
Page 5
Data Dictionary
Value table vs check table While we create tables in some cases we require validating the values of some fields with other table field values or a set of valid values. In this case we use foreign keys. The fields for validate mark as foreign keys in the table. The table containing the foreign keys is called the foreign key table and the table containing the valid set of values is called value table. Its mainly used for the data integrity and consistency in database. Value table is created at domain level. We can specify the set of valid values in domain and can assign this domain with the foreign key field. In this case the valid value in the specified domain is stored in a value table and the foreign key of the table will check against this values. Instead of value tables we mainly use check tables to check the field against the values in other tables.
By Debesh
Page 6
Data Dictionary
For examples there is two tables TI and T2. One of the field values of table T1 should check against the values of the corresponding field of table T2. In this case we mark the field of T1 as foreign key. Now the table T1 is called a foreign key table and table T2 is called as a check table. Following are the requirements (or qualifications) for assigning a foreign key relationship. The fields in check table that is used for foreign key relationship should be primary keys.Both the foreign key field and check table field should have the same domain name.
Technical Settings: To define how the table is handled when it is created in the database.
The data class defines the physical area of the database (table space) in which the table must be created. The size category defines the size of the extents created for the table.
When the table is created in the database, the system determines the required information about the memory area to be selected and the extent size from the technical settings of buffering.
By Debesh
Page 7
Data Dictionary
By Debesh
Page 8
Data Dictionary
SAP Table Buffering Table buffering is used to reduce database load and improves the performance when accessing the data records contained in the database table. The table buffers reside locally on each application server in the system. The data of buffered tables can thus be accessed directly from the buffer of the application server. This avoids the time-consuming process of accessing the database. o The options for selecting the Buffering Buffering not allowed - Table is not required to buffer.
o Buffering allowed but not activated. For a database table buffering is allowed , but at that point of moment buffering should not be active. o Buffering allowed if the table should be buffered. Table should be specified by a buffering type.
By Debesh
Page 9
Data Dictionary
Buffering Types:
o Full buffering - In this buffering type, complete table or none of the table is in the buffer. If a read access is made to a record, all records the table is transferred to the buffer. o Generic buffering - This buffering type is part of the primary key of a table. When a table record is read, this buffer type loads all records that correspond with the generic key. o Single- record buffering - In this buffering type, only the records of a table which are actually accessed are loaded into the buffer.
By Debesh
Page 10
Data Dictionary
b. Pool Table: Hold a large number of very small tables (stores customizing data or system data). Many-to-one relationship with a table in the database. Can be accessed using open SQL. Secondary Indexes cannot be created. Can be buffered.
Database table has different name, different number of fields and fields have different names. Primary key of each table does not begin with same fields or fields
Page 11
By Debesh
Data Dictionary
Holds customizing/system data. Ex: A001,A005,M_MTVMA
By Debesh
Page 12
Data Dictionary
By Debesh
Page 13
Data Dictionary
By Debesh
Page 14
Data Dictionary
By Debesh
Page 15
Data Dictionary
Pooled Table : Create a transparent table and change its table category.
By Debesh
Page 16
Data Dictionary
Many Pooled tables can be assigned to the table pool. c. Cluster Table Hold few number of very large tables (stores mostly system data). Many-to-one relationship with a table in the database. Can be accessed using open SQL.
Page 17
By Debesh
Data Dictionary
Secondary Indexes cannot be created. Cannot be buffered.
Database table has different name, different number of fields and fields have different names. Primary key of each table begins with same fields or fields. BSEG,BSEC,AUAB,PCL1,KONV,CDPOS. Append structure verses include structure Structure is a skeletal view of a table. It contains the definition of columns and dont have any contents. Structure is generally a template based on which a table is created. The basic difference between structure and table is that the structure does not exist at the underlying database system level. Structure exists as definition in the dictionary. Types of Structures:
Append Structure - It will add Fields to the table from last. We can't use that structure in another table. An append structure is a structure assigned to just one table. There can however be several append structures to one table. When a table is activated, all append structures for the table are found and appended to the table. Append structures are used to add customer fields to SAP tables and Custom tables also. Append structures are created in the customer namespace (ZZ or YY). In case of new versions of the standard table during upgrade, the append structures are automatically appended to the new version of the standard table. Append structures cannot be used with cluster and pool tables .Append structures are created in transaction SE11.Append structures should be added at the end of a standard table. This is a must because we should not change the original standard table in the middle. Some standard tables for which there are long data type fields cannot be enhanced because, long type fields should always be at the end and append structures should also be at the end, and so there will be a conflict.
Include Structure: Include structures can used by us to add fields into any custom tables and SAP tables also. Because in a custom we can add fields where ever we want. Include structure can be used more than one time in a table. The same include structure can be included to any no of custom tables. If you add a fields to an include structure all tables that contain that include structure, will be updated too.
By Debesh Page 18
Data Dictionary
Includes can also be nested, i.e. structure A includes structure B, which in turn includes another structure C etc. The maximum nesting depth is limited to nine. A path of nested includes in a table or structure therefore can have at most length nine (excluding the table/structure itself). Only flat structures can be included. In a flat structure, each field either refers to a data element or is directly assigned a data type and length by direct type entry. Only structures can be included in a table. Both tables and structures can be included in a structure, but only one table may lie on a path of nested includes.
There are no limits for append structure size, but the size should be less than the size allocated for the whole table in technical settings. A table can have any number of append structures also it can have nested or deep structures but there is a limitation that nesting possible up to 9 levels. Append structure can have long or string fields.
By Debesh
Page 19
Data Dictionary
By Debesh
Page 20
Data Dictionary
By Debesh
Page 21
Data Dictionary
By Debesh
Page 22
Data Dictionary
By Debesh
Page 23
Data Dictionary
By Debesh
Page 24
Data Dictionary
By Debesh
Page 25
Data Dictionary
2. View Data about an application object is often distributed on several tables. By defining a view, you can define an application-dependent view that combines this data. The structure of such a view is defined by specifying the tables and fields used in the view. Fields that are not required can be hidden, thereby minimizing interfaces. A view can be used in ABAP programs for data selection.
By Debesh
Page 26
Data Dictionary
a. Database View Database views are implement an inner join, that is, only records of the primary table (selected via the join operation) for which the corresponding records of the secondary tables also exist are fetched.
By Debesh
Page 27
Data Dictionary
By Debesh
Page 28
Data Dictionary
By Debesh
Page 29
Data Dictionary
b. Projection View Projection views are used to suppress or mask certain fields in a table (projection), thus minimizing the number of interfaces. This means that only the data that is actually required is exchanged when the database is accessed.
By Debesh
Page 30
Data Dictionary
A projection view can draw upon only one table. Selection conditions cannot be specified for projection views.
By Debesh
Page 31
Data Dictionary
By Debesh
Page 32
Data Dictionary
C. Help View Help views are used to output additional information when the online help system is called.
By Debesh
Page 33
Data Dictionary
When the F4 button is pressed for a screen field, a check is first made on whether a match code is defined for this field. If this is not the case, the help view is displayed in which the check table of the field is the primary table. Thus, for each table no more than one help view can be created, that is, a table can only be primary table in at most one help view.
By Debesh
Page 34
Data Dictionary
By Debesh
Page 35
Data Dictionary
By Debesh
Page 36
Data Dictionary
By Debesh
Page 37
Data Dictionary
By Debesh
Page 38
Data Dictionary
By Debesh
Page 39
Data Dictionary
By Debesh
Page 40
Data Dictionary
By Debesh
Page 41
Data Dictionary
By Debesh
Page 42
Data Dictionary
D. Maintenance View It enables a business-oriented approach to looking at data, while at the same time, making it possible to maintain the data involved. Data from several tables can be summarized in a maintenance view and maintained collectively via this view. That is, the data is entered via the view and then distributed to the underlying tables by the system.
By Debesh
Page 43
Data Dictionary
By Debesh
Page 44
Data Dictionary
By Debesh
Page 45
Data Dictionary
By Debesh
Page 46
Data Dictionary
By Debesh
Page 47
Data Dictionary
By Debesh
Page 48
Data Dictionary
By Debesh
Page 49
Data Dictionary
Go to SE55
By Debesh
Page 50
Data Dictionary
By Debesh
Page 51
Data Dictionary
By Debesh
Page 52
Data Dictionary
By Debesh
Page 53
Data Dictionary
Create Transaction
By Debesh
Page 54
Data Dictionary
By Debesh
Page 55
Data Dictionary
By Debesh
Page 56
Data Dictionary
Run Transaction
By Debesh
Page 57
Data Dictionary
3. SEARCH HELP The input help (F4 help) is a standard function of the R/3 System. The user can display the list of all possible input values for a screen field with the input help. a. Elementary Search Help: Elementary search helps:- defines a search path where we will define the table from which the data has to be read and the selection criteria. Through import and export parameters. Used when we gets the data from a single table.
By Debesh
Page 58
Data Dictionary
By Debesh
Page 59
Data Dictionary
By Debesh
Page 60
Data Dictionary
b. Collective Search Help Combination of elementary search helps. When we need to fetch data based on multiple selection criteria s. More than one table are selection from multiple tables.
By Debesh
Page 61
Data Dictionary
By Debesh
Page 62
Data Dictionary
By Debesh
Page 63
Data Dictionary
4. Lock Object These types of objects are used for locking the access to database records in table. This mechanism is used to enforce data integrity that is two users cannot update the same data at the same time. With lock objects you can lock table-field or whole table. Name starts with EZ.
After the creation of a locking object, two methods are available for your use ENQUEUE_objectname and DEQUEUE_objectname. Types:
o Exclusive (E) or Read mode: The locked data can only be displayed or modified by single user i.e. the owner of the object. Access to other users is denied. o Shared (S) or Write Mode: Several users can access the same record simultaneously, but only in display mode and except the first one, who has asked for the data in update mode. o Exclusive not cumulating (X) it is similar to exclusive lock. It allows only a single user access. Exclusive Lock can be called several times from the same transaction. In contrast, a lock type X can be called only once during the transaction. Any other call for this lock is rejected.
By Debesh
Page 64
Data Dictionary
By Debesh
Page 65
Data Dictionary
By Debesh
Page 66
Data Dictionary
By Debesh
Page 67
Data Dictionary
INDEXING An Index helps to speed up selection from the database. When a table is activated a primary index is created which includes all key fields of the table. When the where condition of a database query does not contain fields from primary index then the whole table is searched. Too restrict this search secondary indexing is done.
By Debesh
Page 68
Data Dictionary
By Debesh
Page 69
Data Dictionary
By Debesh
Page 70
Data Dictionary
Generally there is no limit to create secondary indexes. But more secondary Indexes reduce the performance, so recommended are 4-6.
By Debesh Page 71