You already learned that a database table definition in the ABAP dictionary corresponds to a physical table on the database. Changes to the dictionary object are conveyed to the database object during activation (ALTER TABLE) or through the database adjustment procedure.
Append Structures are a technique that make it possible to add fields to a database table without actually changing the table definition in the ABAP dictionary.
Let us consider a database table that is defined by a software provider, for example, SAP. A customer or partner wants to add fields to this database table.
Instead of adding the fields to the database table definition in the dictionary, they create an append structure. The append structure is a separate dictionary object, owned and maintained by the customer or partner. Technically, it is a structure type in the ABAP dictionary. However, it is linked to database table definition and defines additional fields for the related database table. When the append structure is activated, its components are added as fields to the table on the database.
You can say that the table on the database is defined by two dictionary objects: The database table definition and the append structure.
Note
One append structure belongs to exactly one database table . One database table, however, can have several append structures.
In ABAP Cloud, you can only create an append if the software provider released the table definition for extension.
But what happens if the software provider ships a new version of the database table definition?
Let us consider that in a future release, the database table will contain an additional field. The solution is simple: during the upgrade, the new field is simply added to the field catalog of the database table, using the ALTER TABLE statement. The different field sequence on the database and in the dictionary is not a problem for the ABAP environment.
Here is an example for an append structure.
The code on the left shows the definition of database table /DMO/AGENCY. The code on the right shows the definition of append structure Z00_EXT_AGENCY. The link between the two dictionary objects is established in the append structure by mentioning the database table after keyword EXTEND TYPE.
The append structure has one component zzcategory. It is added to the field list of database table /DMO/AGENCY.
There is a reason why the component of the append structure starts with "ZZ". Table fields and structure components starting with "ZZ" or "YY" lie in the customer namespace. SAP guarantees that tables shipped by SAP will never contain fields in the customer namespace. By choosing field names in the customer namespace, customers can avoid field name conflicts if SAP adds new fields to the target table.
The append technique not only works for database table definitions. You can also use append structures to add components to a structure type.
In this example, the append structure on the right extends dictionary structure /DMO/S_EXT_INCL_AGENCY with a field ZZCATEGORYZAG.