Professional Documents
Culture Documents
ABAP Dictionary
ABAP Dictionary
Contents Page
Introduction…………………………....………………………………………………..2
Object types in the ABAP Dictionary…………………………………..………..…2
Tables……………………………………………………………………………………...3
Commonly used SAP standard tables…………………………………………..….5
Difference between Standard tables, Pooled tables and Cluster Tables……6
Views………………………………………………………………………………………6
Types………………………………………………………………………..……………10
Lock Objects……………………………………………………………………………11
Domains…………………………………………………………………………………12
Search Help……………………………………………………………………..……..13
Difference between a check table and a value table ………………………….13
Naming notation………………………………………………………………………14
ABAP Dictionary FAQ…………………………….………………………………….15
Introduction:
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.
The ABAP Dictionary supports the definition of user-defined types (data elements, structures and table
types). You can also define the structure of database objects (tables, indexes and views) in the ABAP
Dictionary. These objects can then be automatically created in the database with this definition. The
ABAP Dictionary also provides tools for editing screen fields, for example for assigning a field an input
help (F4 help).
The ABAP Dictionary also provides standard functions for editing fields on the screen, for example for
assigning a screen field an input help. Information Stored in the ABAP Dictionary.
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. Transparent table, Pool
table and cluster table are data dictionary table objects sorted table, indexed table and hash table are
internal tables.
Transparent Table: Exists with the same structure both in dictionary as well as in database exactly
with the same data and fields.
Pooled Table: Pooled tables are logical tables that must be assigned to a table pool when they are
defined. Pooled tables are used to store control data. Several pooled tables can be combined in a table
pool. The data of these pooled tables are then sorted in a common table in the database.
Cluster Table: Cluster tables are logical tables that must be assigned to a table cluster when they are
defined. Cluster tables can be used to store control data. They can also be used to store temporary data
or texts, such as documentation.
There are five types of Internal Tables: Standard Tables, Sorted Table, Index Table,
Hashed Table, Any Table (Generic type, rarely used).
Pooled Table:
Table pools (pools) and table clusters (clusters) are special table types in the ABAP Dictionary. The data
from several different tables can be stored together in a table pool or table cluster. Tables assigned to a
table pool or table cluster are referred to as pooled tables or cluster tables. A table in the database in
which all records from the pooled tables assigned to the table pool are stored corresponds to a table
pool. The definition of a pool consists essentially of two key fields (Tabname and Varkey) and a long
argument field (Vardata). Table Clusters Several logical data records from different cluster tables can be
stored together in one physical record in a table cluster. A cluster key consists of a series of freely
definable key fields and a field (Pageno) for distinguishing continuation records. A cluster also contains a
long field (Vardata) that contains the contents of the data fields of the cluster tables for this key. If the
data does not fit into the long field, continuation records are created. Control information on the structure
of the data string is still written at the beginning of the Vardata field.
Hashed tables:
This is the most appropriate type for any table where the main operation is key access. You cannot
access a hashed table using its index. The response time for key access remains constant, regardless of
the number of table entries. Like database tables, hashed tables always have a unique key. Hashed
tables are useful if you want to construct and use an internal table which resembles a database table or
for processing large amounts of data.
Views:
Data for an application object is often distributed on several database tables. A database system
therefore provides a way of defining application-specific views on data in several tables. These are called
views. Data from several tables can be combined in a meaningful way using a view (join). Information can
be kept hide that is of no interest to projection or only display those data records that satisfy certain
conditions (selection).The data of a view can be displayed exactly like the data of a table in the extended
table maintenance.
Given two tables TABA and TABB. Table TABA contains 2 entries and table TABB 4 entries. The tables
are first appended to one another. This results in the cross-product of the two tables, in which each
record of TABA is combined with each record of TABB.
Usually the entire cross-product is not a meaningful selection. You should therefore limit the cross-
product with a join condition. The join condition describes how the records of the two tables are related.
In our example, Field 3 of TABB identifies Field 1 of TABA. The join condition is then: TABA - Field 1 =
TABB - Field 3With this join condition, all the records whose entry in Field 1 is not identical to the entry in
Field 3 are removed from the cross product. The column for Field 3 in the view is therefore unnecessary.
Structure of a VIEW:
Often some of the fields of the tables involved in a view are of no interest. You can explicitly define the
set of fields to be included in the view (projection). The set of records that can be displayed with the view
can be further restricted with a selection condition. In our example, only those records with value 'A' in
Field 4 should be displayed with the view. A selection condition therefore can also be formulated with a
field that is not contained in the view. The join conditions can also be derived from the existing foreign
key relationships. Copying the join conditions from the existing foreign keys is supported in the
maintenance transaction. The field names of the underlying table fields are normally used as field names
in the view. However, you can also choose a different field name. This is necessary for instances if two
fields with the same name are to be copied to the view from different tables. In this case you must
choose a different name for one of the two fields in the view. Selection with a database view, however, is
usually more efficient than selection with a nested SELECT statement. A view has type character and
can be accessed in programs like all other types and can be used to define data objects.
Database VIEWS:
A database view is defined in the ABAP Dictionary and automatically created on the database during
activation. Accesses to a database view are passed directly to the database from the database interface.
The database software performs the data selection. If the definition of a database view is changed in the
ABAP Dictionary, the view created on the database must be adjusted to this change. Since a view does
not contain any data, this adjustment is made by deleting the old view definition and creating the view
again in the ABAP Dictionary with its new definition. The maintenance status defines whether you can
only read with the view or whether you can also write with it. If a database view was defined with more
than one table, this view must be read only. The data read with a database view can be buffered. View
data is buffered analogously to tables. The technical settings of a database view control whether the view
data may be buffered and how this should be done. The same settings (buffering types) can be used
here as for table buffering. The buffered view data is invalidated when the data in one of the base tables
of the view changes.
You can include entire tables in database views. In this case all the fields of the included table become
fields of the view (whereby you can explicitly exclude certain fields). If new fields are included in the table
or existing fields are deleted, the view is automatically adjusted to this change. A new or deleted field is
therefore automatically included in the view or deleted from it. If an append structure is added to a table
included in a view, the fields added with the append structure are automatically included in the view. To
include a table in a view, you must enter the character '*' in field View field in the view maintenance, the
name of the table to be included in the field Table and the character '*' again in the field Field name. If
you do not want to insert a field of the included table in the view, you must enter a '-' in field View field,
the name of the included table in field Table and the name of the field to be excluded in field Field name.
Fields of the base tables of a database view can be included in the view without modifications using an
append view. This is analogous to enhancing a table using an append structure. An append view is
assigned to exactly one database view. But more than one append view can be created for a database
view.
Maintenance VIEWS:
Data that is distributed on more than one table often forms a logical unit, called an application object. You
should be able to display, change and create the data of such an application object together. Users
usually are not interested in the technical implementation of the application object, such as the
distribution of the data on several tables. You can maintain complex application objects in a simple way
using a maintenance view. The data is automatically distributed on the underlying database tables. All
the tables used in a maintenance view must be linked with a foreign key. This means that the join
conditions are always derived from the foreign key in the maintenance view. You cannot enter the join
conditions directly as in a database view. A maintenance interface with which the data of the view can be
displayed, changed and created must be generated from the definition of a maintenance view in the
ABAP Dictionary. When the maintenance interface is created, function modules that distribute the data
maintained with the view on the underlying tables are automatically generated. The maintenance
interface is generated with the Transaction Generate Table View (Transaction SE54) or from the view
maintenance screen with Utilities -> Tab.maint.generator.
Types:
Types are used in ABAP programs. The structure of a type can be defined globally in ABAP programs.
Changes to a type automatically take effect in all the programs using the type.
You can define any user-defined types in the ABAP Dictionary. These can be used in the ABAP program
to define data objects and types analogously to types that are predefined in the ABAP program (such as
C or I) or types that are defined locally in ABAP programs. The following type categories can be defined
in the ABAP Dictionary:
Data elements (elementary types): Elementary types have no structure. They describe the data type
attributes (such as given Dictionary data type, number of places) and information that is relevant for the
screen (such as title) of unstructured data objects (variables/fields).
Structures (structured types): Structured types describe the structure and functions of any structured data
objects that is of data structures with components of any type. A component can be a field with an
elementary type or can itself be a structure. A table can also be used as a component in a structure. A
database table always has a structure and is therefore implicitly a structured type. However, the fields of
a database table can only have an elementary type.
Table types: Table types describe the structure and functions of internal tables in the ABAP program.
Their rows can have any row type. Table types with elementary row type therefore can be defined just the
same as multi-dimensional table types (table types with a table type as row type) or table types using
structures with table-like components.
The options for creating types with structured types and table types can be combined as required. In this
way you can define any complex types globally in the ABAP Dictionary and use them in ABAP programs.
The runtime object of the Dictionary type (nametab) is the interface for their use in ABAP programs. The
runtime object permits very efficient access to the relevant information for the type in compressed form.
The central definition of types that are used more than once in the ABAP Dictionary allows them to be
changed centrally. These changes are made at all the relevant locations by the active ABAP Dictionary.
For example, ABAP programs adjust to the changed type definitions when they are recreated. When a
type is changed, all the objects (e.g. types or tables) that use this type are automatically adjusted to the
change at activation. All Dictionary types lie in a common namespace. A data element, for example,
therefore may not have the same name as a structure. However, a type defined in an ABAP program and
a Dictionary type may have the same name. The following shadowing rule is valid when using types in
ABAP programs: If the names are identical, the local types shadow the types of the type groups and the
types defined globally in the Dictionary.
Lock Objects:
Lock Objects are used to synchronize access to the same data by more than one user. Function modules
that can be used in application programs are generated from the definition of a lock object in the ABAP
Dictionary.
Structure of Lock Object:
Lock objects are use in SAP to avoid the inconsistency at the time of data is being insert/change into
database. SAP Provide three types of Lock objects.
Read Lock (Shared Locked): Protects read access to an object. The read lock allows other transactions
read access but not write access to the locked area of the table.
Write Lock (exclusive lock): Protects write access to an object. The write lock allows other transactions
neither read nor write access to the locked area of the table.
Enhanced write lock (exclusive lock without cumulating): Works like a write lock except that the enhanced
write lock also protects from further accesses from the same transaction.
You can create a lock on a object of SAP through transaction SE11 and enter any meaningful name start
with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not
allow to any other user to open the same object in change mode. Example: in HR when we are enter a
personal number in master data maintenance screen SAP can't allow to any other user to use same
personal number for changes.
When you create a lock object System automatically create two function module.
1. ENQUEUE_<Lockobject name>. To insert the object in a queue.
2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
Domains:
Different fields having the same technical type can be combined in domains. A domain defines the value
range of all table fields and structure components that refer to this domain. A domain defines a value
range. A domain is assigned to a data element. All table fields or structure components that use this data
element then have the value range defined by the domain. The relationship between the field or
component and the domain is thus defined by the data element of the field or component. Fields or
components that refer to the same domain (with the assigned data elements) are also changed when the
domain is changed. This ensures that the value ranges of these fields or components are consistent.
Fields or components that are technically the same can thus are combined with a reference to the same
domain.
The value range of a domain is defined by specifying a data type and length (and number of decimal
places for numeric data types). A personnel number is defined by the data format NUMC and by
specifying the number of places for this personnel number.
The value range of a domain can be restricted by defining fixed values. If all the fields or components that
refer to the domain should be checked against a certain table, this table can be defined as the value table
of the domain. Output attributes can also be defined for all the fields or components that refer to the
domain. A conversion routine can be assigned to a domain. This conversion routine converts values from
display format to internal format for the fields or components that refer to this domain.
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. The possible input values can be enhanced with further information. This is
meaningful especially when the field requires the input of a formal key. A user calls an input help with the following steps
(some steps can be omitted, depending on the definition of the input help):
The user starts the input help to display the possible input values for a field (search field) in a screen template.
▼
The system offers the user a number of possible search paths.
▼
The user selects one of these search paths.
▼
Each search path offers a number of restrictions to limit the number of possible input values.
▼
These values are offered in a Dialog box for value restriction when the search path is selected.
▼
The user enters restrictions if required and then starts the search.
▼
The system determines the values that satisfy the entered restrictions (hits) and displays them as a list (hit list).
▼
The user selects the most suitable line from the hit list by double-clicking.
▼
The value of the search field is returned to the screen template (possibly together with other values).
Check table: For example you have Employee master table & Employee Transaction table. When
ever an employee Transacts we need to check whether that employee exists, so we can refer to
the employee master table. This is nothing but a Parent & Child relationship. Here data can be
maintained at client level, no development involved. As per DBMS what we call foreign key table,
is called as check table in SAP.
There is 1 more important Difference in Value Table and Check Table is that:
The contents of the check will be used as an input help (F4 Help) for a particular field on which a
check table is assigned. But the contents of Value Table are never used in Input Help.
The Hierarchy which decides from where to use the Input Help is:
1. Input help defined explicitly in ABAP Program or Dialog Module.
2. Input Help Attached to the referenced Database Table field.
3. Using the contents of Check Table as an input helps if neither (1) or (2) help are there.
4. Input help from fixed value or Value range given in Domain.
Naming notation
ABAP has a large number of naming conventions for different language elements. Below is a list.
ALV_* Advance list viewer
AS_* Methods that perform type conversions
CHECK_* Check Methods
CH_* Changing Parameters
CL_* Class name
CO_*/C_* Constants
DR_* Data reference
G_* Global variables/data objects
GT_* Global table
GX_* Global Boolean field (X or space)
IF_* Interface
INT_*/IT_ Internal Table
IS_* Methods that return a Boolean value
L_* Indicates the data object is local. Often, before underscore, put a 'type letter' in case of simple type (LC_,LF
etc.)
LC_* Local Constant
LR_* Local Range
LT_* Local Table
LVC_* List Viewer Control
ON_* Event handler
PA_* Parameters
PE_*/EX_* Export parameter
PI_*/IM_* Input parameter
RA_* Ranges/Type Range Of
RE_* Result
RF_* Reference Variable
SET_* Accessors Methods
SO_* Select-Options
ST_* Structure
TA_* Internal Standard Table
TC_* Table Control
TH_* Internal Hashed Table
TP_* Other Variables
TS_* Internal Sorted Table
TT_* Table type
TY_* Types
T_* Variable is a table (T_MY_TABLE_VARIABLE)
X* Source/first data object (e.g. XVBAK)
Y* Destination/second data object (e.g. YVBAK)
WA_* Working Area
Q: What is the need of reference table and reference field in Currency/Quantity fields?
Answer: The reference table and reference field are the fields which specify the currency key or Unit of
Measure. Suppose if the user specifies a currency amount say 1000$, the currency amount field would
indicate the amount 1000 and the currency key indicates that the currency specified is in Dollars.