sap data dictionary

71
Data Dictionary By Debesh Page 1 A-Z of 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 let’s 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.

Upload: sagarmohane

Post on 02-May-2017

291 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: SAP Data Dictionary

Data Dictionary

By Debesh Page 1

A-Z of 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 let’s 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.

Page 3: SAP Data Dictionary

Data Dictionary

By Debesh Page 3

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.

Page 4: SAP Data Dictionary

Data Dictionary

By Debesh Page 4

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.

Page 6: SAP Data Dictionary

Data Dictionary

By Debesh Page 6

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. It’s

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.

Page 7: SAP Data Dictionary

Data Dictionary

By Debesh Page 7

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

Page 9: SAP Data Dictionary

Data Dictionary

By Debesh Page 9

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.

- The options for selecting the Buffering

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

Page 10: SAP Data Dictionary

Data Dictionary

By Debesh Page 10

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

Page 11: SAP Data Dictionary

Data Dictionary

By Debesh Page 11

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 12: SAP Data Dictionary

Data Dictionary

By Debesh Page 12

- Holds customizing/system data.

- Ex: A001,A005,M_MTVMA

Page 17: SAP Data Dictionary

Data Dictionary

By Debesh Page 17

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 18: SAP Data Dictionary

Data Dictionary

By Debesh Page 18

- 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 don’t 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.

Page 19: SAP Data Dictionary

Data Dictionary

By Debesh Page 19

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.

Page 26: SAP Data Dictionary

Data Dictionary

By Debesh Page 26

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.

Page 27: SAP Data Dictionary

Data Dictionary

By Debesh Page 27

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.

Page 30: SAP Data Dictionary

Data Dictionary

By Debesh Page 30

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.

Page 31: SAP Data Dictionary

Data Dictionary

By Debesh Page 31

A projection view can draw upon only one table. Selection conditions cannot be specified for

projection views.

Page 34: SAP Data Dictionary

Data Dictionary

By Debesh Page 34

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.

Page 43: SAP Data Dictionary

Data Dictionary

By Debesh Page 43

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.

Page 54: SAP Data Dictionary

Data Dictionary

By Debesh Page 54

Create Transaction

Page 57: SAP Data Dictionary

Data Dictionary

By Debesh Page 57

Run Transaction

Page 58: SAP Data Dictionary

Data Dictionary

By Debesh Page 58

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.

Page 61: SAP Data Dictionary

Data Dictionary

By Debesh Page 61

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.

Page 64: SAP Data Dictionary

Data Dictionary

By Debesh Page 64

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.

Page 68: SAP Data Dictionary

Data Dictionary

By Debesh Page 68

- DEQUEUE_EZLOCK_TAB has similar structure

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.