Monday, January 20, 2014



The active version of an ABAP Dictionary object is the one that is accessed by the components of the runtime environment, such as the ABAP processor and database interface.
On the other hand, the inactive version is created when an active object is changed. It does not affect the runtime system. The inactive version can be changed into an active version through a process called activation.
The slide here illustrates change in the status of an object. Initially, an active structure contains three fields. When an additional field is added to this structure in the ABAP Dictionary, it results in two versions of the same structure. One is an active version containing the original fields and the other is an inactive version containing the additional field. During the activation process, the inactive version replaces the active version. Thus, the inactive version becomes the active version resulting in only a single active version with the four fields.


In the ABAP Dictionary, information about a structure or table is stored in data elements and structure definitions. The runtime object combines this information into a structure which is so designed that it can be easily accessed from ABAP programs.
You can create runtime objects for all ABAP Dictionary objects that can be used as types in ABAP programs, such as data elements, table types, and views. These objects hold varied information about the overall structure, the individual structure fields, as well as additional information regarding client dependence, buffering, and key fields required for accessing the table data.


When some change occurs in a domain, then all the data elements, structures, and tables referring to this domain must be reactivated. This is done so that all affected runtime objects adjust to the changed type information.
Each object in the ABAP Dictionary maintains a ‘where-used list’ that provides information about all the other objects that refer to it.
Using this list, you can determine the direct and indirect usages of the ABAP Dictionary object. For this, you need to define the usage object types that have to be included in the search; for example, all structures and tables using a data element.
You can also search the usages of objects that are not part of the ABAP Dictionary, such as all programs, using a table.
Object usage search can also be limited by the development class or user namespace.


This slide illustrates how to conduct search for ABAP Dictionary objects and their users with the help of the general Repository Information System which includes Repository Information System ABAP Dictionary. You can call the Where-used lists for Repository objects from the information system to search for objects by their attributes. Additionally, you can search for all objects by development class, author, and date of last change.



If you can input only a limited set of values while creating a domain, then these values are defined as fixed values. These can either be listed individually or defined as an interval. Moreover, fixed values generate F4 Help. As soon as screen entries are made, the fixed values are immediately used as check values.
When fixed values are specified, the value range of the domain gets limited by these values. The value range of a field is determined by its data type and field length.


The value range of a field can be defined using a value table. You can define the value range of a field by specifying a value table in the domain. Validation occurs only after a foreign key is defined for a field or component. In such cases, the system proposes the value table as a check table.


This slide illustrates the flight booking details of a customer with American Airlines (AA). The user places an inquiry whether the booking can be made at counter 8. While Table SBOOK mentions all the flight bookings of the airlines, Table SCOUNTER contains all the valid counters of the airlines. If an entry is made in field COUNTER of table SBOOK, you must ensure that only valid counters are entered. Therefore, these counters must be stored in table SCOUNTER.


The booking entries made in table SBOOK are rejected as no corresponding data record for COUNTER is selected from table SCOUNTER. The customer’s request for booking this particular flight at counter 8 is rejected as the counter for American Airlines (AA) is 1 rather than 8. Such relationships between two tables are defined in the ABAP Dictionary using foreign keys which must be defined explicitly for the fields. By using foreign keys, consistency of data is ensured as data that is entered is matched against the existing data.


Let us understand how to use foreign key fields using two tables, SBOOK and SCOUNTER. Here, Table SBOOK is the foreign key table. Its purpose is to ensure that only valid carrier counters can be assigned to a booking.
On the other hand, Table SCOUNTER is the check table and contains exactly the same information. Each counter in this table has three key fields; namely MANDT, CARRID, and COUNTNUM.
You can define the foreign key by assigning these three fields to the fields of the foreign key table which is used to enter the input on the screen. The entry is accepted only if the entry represents a valid counter. The COUNTER field is called the check field for this foreign key defined for field SBOOK-COUNTER. This means that the entry in this field is checked.
In the example shown here, a foreign key is defined for field COUNTER leading to three check tables, SCOUNTER-CLIENT, SCOUNTER-CARRID, and SCOUNTER-COUNTNUM; and three foreign key tables, SBOOK-MANDT, SBOOK-CARRID, and SBOOK-COUNTER.


The check field is the field of the foreign key table that is to be checked. A foreign key is a group of fields of a table that is also the primary key for another table. Therefore, a foreign key links two tables, the check table and the foreign key table. The check table, also known as the referenced table, is the table whose key fields are checked. The foreign key table contains entries which must be consistent with the key fields of the check table.


Domain equality between the check field and the referenced key field of the check table is a mandatory requirement in the ABAP Dictionary. By using the same domain for the check field and the referenced key field of the check table, there will not be any need to compare fields with different data types and field lengths. While you can use different data elements, they must always refer to the same domain. If domains are not equal, the foreign key will not be consistent. If the domain of the check field contains a value table, the value table can act as check table, if the value table does not have any foreign key.
However, for all other foreign key fields, only the data type and the field length are required to be equal.

This slide illustrates an example of a foreign key definition. It shows the system proposal for the field AGENCYNUM in SBOOK, on the basis of the value table in the domain.
Let us assume that SBUSPART is the check table. For check table SBUSPART-CLIENT, the foreign key table is SBOOK-CLIENT, while for check table SBUSPART-BUSPARTNUM, the foreign key table is SBOOK-AGENCYNUM.
However, this proposal is not correct. The SBUSPART table contains all the business partners of airline carriers. However, only agencies are allowed for field SBOOK-AGENCYNUM. Table SBUSPART, therefore, contains invalid data for this field. In fact, table STRAVELAG is the correct check table. It is a subset of table SBUSPART owing to its foreign key definition on field AGENCYNUM.


Cardinality is a semantic attribute that describes the foreign key relationship with regard to the number of records of the check table that are assigned to records of the foreign key table. The cardinality must be defined with regards to the check table.
A foreign key field can identify a table entry based on its type. There are four types of foreign key fields:
Not specified means that there is no information about the kind of foreign key field.
No key fields or candidates suggests that 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 fields or candidates indicates that the foreign key fields are either primary key fields of the foreign key table or they uniquely identify a record of the foreign key table.
Key fields of a text table means that the foreign key table acts as a text table in the check table in cases where the key of the foreign key table only differs from the key of the check table in an additional language key field.


Table SMEAL depicts information about in-flight meals provided to the passengers. The meal names are maintained in another table, SMEALT. Table SMEALT is the text table for table SMEAL as the key of SMEALT comprises the key of SMEAL and an additional language key field. An explanatory text for all the key entries of SMEAL can also be given in Table SMEALT.
You must link the text table SMEALT with table SMEAL using a foreign key to link the key entries with the text. Key Fields of a text table must be selected for the type of the foreign key fields.



An index is a copy of the database table containing only the key fields. As data in an index is sorted, it can be accessed and retrieved instantly. Indexes also contain a pointer from the index entry to the corresponding table entry.
When index is used for data retrieval, all fields constituting the index will participate in the WHERE clause. In the example shown in the slide, the SELECT * statement is used to fetch data from the SCARR table where the value of CARRID is LH. Therefore, binary search is used to locate the records in data table. LH is in the first position in the WHERE clause as it has the maximum number of selections, 14.


The function of the database optimizer is to determine which index should be used by the database for accessing data records. When you use the SELECT * statement with carname as Lufthansa, the database optimizer selects the SCARR NAM index table to fetch data from the SCARR table.
There are two types of indexes: Primary and Secondary. The index type of a particular index can be determined by its three-place index ID. If the index ID is zero, it denotes a primary index.
Customers can also create their own indexes on SAP tables. The index IDs for such indexes always begin with either Y or Z.


You can use table buffers to increase performance when reading records from a table. The buffers reside locally on the application servers. During the initial access, data is read from the database. Thereafter, data remains loaded into the buffer and is accessed directly from it. This speeds up the whole process.

Full buffering means that a table is either completely buffered or not buffered at all. In full buffering, when a single record is accessed, all the records of that table are also loaded into the buffer. There are three points to be kept in mind while using full buffering. These are
  the size of the table to be buffered;

  the number of read accesses; and

  the number of write accesses.

It is commonly observed that the smaller the table is; the more frequently it is read and the less frequently it is written. This makes it ideal for full buffering. It is also recommended for tables that have frequent accesses to records that do not exist.

With generic buffering, when you access a particular record, all other records whose generic key fields match this record are loaded into the buffer. The generic key for a table is the left-justified part of a primary key that is specified when the buffering type is selected.


Single-record buffering is preferred for
  records that are accessed with SELECT SINGLE command; and

  tables in which the individual entries are repeatedly accessed.

In single-record buffering, only those records that are actually accessed are loaded into the buffer. This can save a lot of storage space in the buffer compared to generic and full buffering. However, in this case, the overhead for buffer administration is higher than that for generic or full buffering.


The buffers reside locally on the application servers. During initial access, data is read from the database. Thereafter, data remains loaded into the buffer and are accessed directly from it, making the data access easier and faster. However, another program can change this data in the database. Therefore, data must be synchronized.


As the buffers reside locally on the application servers, they must be synchronized after any data has been modified in a buffered table. This synchronization occurs at periodic intervals laid down in the system profile.
Let us understand this process with an example.
As shown here, two application servers need to access Table SCARR in the database. Server 1 first reads the records from Table SCARR on the database. This table is then loaded into a local buffer on server 1. This local buffer is subsequently used by server 1 to access the data.


Here, Server 2 accesses the records from Table SCARR in the database and loads it into its local buffer.


If a user on Server 1 deletes certain records from the SCARR table and updates the database, then Server 1 writes an entry in the synchronization table and updates its local buffer.


A user on Server 2 can still access the deleted records because the records reside in his local buffer, even though they no longer exist in the database table. If the same access had been made through an application program to Server 1, it would have replied stating that the records no longer exist.


The synchronization of the servers takes place at fixed time intervals. During synchronization, both servers check the synchronization table to look for any modifications.
Server 2 now realizes that the SCARR table has been modified by server 1 and immediately invalidates the table in its local buffer. Server 1, on the other hand, does not need to invalidate the table in its buffer, since it had made the modification initially. Therefore, it continues to use the table in its buffer to access the SCARR table.


After the table in its buffer is invalidated during the synchronization process, Server 2 accesses the SCARR table again. It does this through the database. The SCARR table from the database is now reloaded into the local buffer of Server 2.

This slide illustrates a decision-making tree for buffering tables. It illustrates the decision-making process involved in buffering tables. It is seen that buffering significantly increases performance. This is because table buffers reside locally on an application server and are refreshed at regular intervals. However, it is important to select the right type of buffering. Another crucial point is that the more frequently a table is read; and the less frequently its contents are changed, the better it is to buffer the table.



The globally known data types are defined using the Data Type field.
You can define the type group for creating global constants using the Type Group field.
The Domain field is where the technical properties of data objects can be defined.


You can generate data objects in the ABAP programs using the data types declared in the ABAP dictionary.
However, an ABAP program cannot access domains for defining data objects. The data elements get their data types from domains.
The components of a structure can be elementary fields, tables, as well as structures.
A structured type or an elementary type can be the line type of a table type (ITAB).


Domains cannot be used directly in programs or tables.
Therefore, data element is used as a bridge from the technical properties to the different data types or data objects.
You can define technical attributes and value ranges.
The most frequently used data types are CHAR, DATS, DEC, and NUMC. CHAR, the character string, can have a maximum length of 255 in tables. DATS defines the date and the length is set at eight characters.
DEC is used for the calculation of an amount in a field, and contains operators, such as the point, the plus or minus (+/-) sign, and thousand-separator commas. It can have a maximum of 31 characters.
NUMC is used for character strings that comprise only numbers. It is restricted to a maximum of 255 characters.


Data elements not only constitute the link between domains and the data objects, but also contain semantic or technical information about the data objects created from these.
You can translate the field labels into other languages by choosing the transaction SE63 or the menu path: Goto → Translation.
You can append F4 or input help to a data element.
You can assign the SET or GET parameter to the data element, if an input field based on the same data element exists on a subsequent screen. This helps you read the value from the parameter and enter it in the screen field.


Structure components can be data elements, integrated types, structure definitions of internal tables, DB table views, or other existing structure definitions. The data object, generated by including the fields of an actual two-dimensional object like a view or DB tables, remains flat or one-dimensional.


A flat structure is formed by the sequence of fields through the use of data elements. A one-dimensional data object is formed with this structure type. The individual elements or components of the structure can be addressed by using the name of the structure, a hyphen, and the name of the components.


A nested structure is formed by including another structured object in the structure and assigning it to a component.
You can nest structures like these into one another in any way.


Internal tables can be defined using an existing line structure. You can use database tables, structure definitions, views, data elements, direct type definitions, or existing table types as line types.
A two-dimensional array is created in the main memory by declaring an internal table in an ABAP program.


A deep structure is formed by inserting an internal table as a structure component. It contains at least one table. The component of such a table has its own name and can be addressed like a normal internal table (LOOP AT..., INSERT... INTO TABLE, ...).
An internal table can have a deep structure as a line type. Thus multidimensional data types can be created as you can inter-nest internal tables and structures several times.


You declare the type group using the TYPE POOL statement. This enables you to use the types of a type group in a program.
All names of these data types and constants must begin with the name of the type group and an underscore.
You define global constants using a type group, which should have a name not more than five characters long.
In the type group, you use the CONSTANTS statement to define constants, as well as to declare cross-program constants.


A table consists of
  columns (fields) and rows (entries);

  a unique table name and certain general attributes, such as delivery class and maintenance authorization; and

  certain key fields called the primary keys, whose values uniquely identify each entry of the table.


The basic objects for defining data in the ABAP Dictionary are

  data elements, and


Domains are used for technical definition of table fields, such as field type and length. One domain may be used by more than one data element.
Data elements, on the other hand, are used for semantic definitions, such as short descriptions. One data element may be used by more than one field of one or more tables.
A field in a table is not an independent object. It is table-dependent and can only be maintained within a table.


A single domain can be used for different data elements.
Let us assume that flight schedules are stored in a table SPFLI. The table contains the fields AIRPFROM (departure airport) and AIRPTO (arrival airport). These fields have the same domain S_AIRPID because both fields contain airport IDs and therefore have the same technical attributes.
They have a different semantic meaning, however, and use different data elements to document this. The field AIRPFROM uses data element S_FROMAIRP while field AIRPTO uses data element S_TOAIRP.


A transparent table is automatically created on the database when it is activated in the ABAP Dictionary. When this happens, the database-independent description of the table from the ABAP Dictionary is translated into the language of the corresponding database system.
The database table thus created, along with its fields, has the same name as the table in the ABAP Dictionary. The data types in the ABAP Dictionary are converted to the corresponding data types of the database system.
The order of the fields in the ABAP Dictionary can differ from the order of the fields on the database.
Transparent tables can be accessed by ABAP programs in two ways:
  Access the data in the table with the OPEN SQL or the EXEC SQL command.

  Access a structured type defined in the table, only when variables or more complex types are defined.A structured type, for which there is no corresponding object in the database, can also be created in the ABAP Dictionary. Such types are called structures. Structures can also be used to define the types of variables.


To avoid redundant structure definitions, you can include structures in tables or within other structures. A table can only be included in its entirety.
A chain of includes may only contain one database table.
An include can contain other includes.


Technical settings help determine how to manage the tables once they are created on the database; whether they should be buffered; and whether modifications to the entries should be logged.
Once a table is activated in the ABAP Dictionary, it is automatically created in the database. You can deduce the information on storage area and expected table size from the settings for the data class and size category. The buffer settings specify how the table should be buffered, if necessary. You can also define whether modifications to the table entries should be logged.


One way to defragment the indexes is to simply delete and reenter them. The database once again calculates the content and structure of the index, and creates a single memory space, where possible, in the storage medium. During this process, you can still use the database tables.
You can reduce fragmentation in fragmented tables by converting them. All the data is first transferred to a new table created by the SAP system. The old table is deleted and replaced by the new one. If the new table grows unexpectedly and quickly, it is also checked again, before being converted.


A data class logically defines the physical area of the database in which your table should be stored. If defined correctly, tables will automatically be created in the right areas on the database, when they are activated in the ABAP Dictionary.
The four main data classes are
  master data,

  transaction data,

  organizational data, and

  system data.

Master data is rarely modified. One example of master data is an address file, with a name, an address, and a telephone number.
Transaction data, on the other hand, is frequently modified. An example of transaction data is the material stock of a warehouse, which can change after every purchase order.
The third main data class, organizational data, is defined during Customizing when the system is installed. It is rarely modified after that. Country keys are examples of organizational data.
The last data class, system data, is the data required by the SAP System itself. Program sources are examples of system data.


The size category describes the expected storage requirements for a table in a database.
When a table is initially created in the database, a fixed extent is reserved for it, irrespective of its size category. If more space is required later, additional extents can be added. The sizes of these additional extents are fixed and are determined by the size category specified in the ABAP Dictionary.
Size categories range from 0 to 4.


Logging is used to record and store modifications to the entries of a table.
However, this option is available only if the SAP System contains the parameter rec/client, which can be set to different values to define which clients have log access.
Data modifications are logged independently of the update.


Pooled and cluster tables are other database table types.
The definition of transparent tables is identical in both the ABAP Dictionary and the database. In contrast, pooled and cluster tables comprise several tables, which are logically defined in the ABAP Dictionary, but are combined into a single physical database table.


Cluster tables store functionally dependent data, divided among different tables, in a single database table. The intersection of the key fields of the cluster tables, or the key of the table cluster, is called the cluster key.
Data dependent on a single cluster key is stored in the VARDATA field of the table cluster.
The database interface also compresses the contents of the VARDATA field. The latter, therefore, includes a description for decompressing its data.
The PAGNO field of the cluster table ensures that all entries are unique; while the TIMESTAMP and PAGELG fields contain administrative information.


Table pools, unlike the table clusters, store data records from independent tables defined in the ABAP Dictionary.
This example depicts the intersection of the key fields of TABA and TABB, which is empty. Despite this difference, the data records from TABA and TABB are stored in a single database table, the TABAB table pool.
The key for a data record of the TABAB table pool consists of a combination of the fields TABNAME and VARKEY.
The TABNAME field assumes the name of the pooled table.
The VARKEY field comprises the key fields of the pooled table.
The VARDATA field contains the non-key fields of the pooled tables, stored in an unstructured way. These are also compressed by the database interface. The length of the VARDATA field is stored in the DATALN field.


Pooled and cluster tables contain far fewer tables, as a direct result of the combination of tables and of data compression.
This translates into fewer different SQL statements.
The main disadvantage of pool and cluster tables is the limited database functionality. There is no support for primary or secondary indices, database views, ABAP JOINs, or Table Appends. Moreover, the data in these tables can only be accessed through OPEN SQL .