• No results found

36 Enhancing Tables Using Append Structures and Customizing Includes

LESSON OVERVIEW

This lesson explains the two ways that enable you to add extra fields to an SAP table, append structures and Customizing Includes, without actually modifying the table.

Business Example

You would like to add fields to SAP tables without implementing modifications. For this reason, you require the following knowledge:

How to enhance tables using append structures

How to enhance tables using Customizing Includes LESSON OBJECTIVES

After completing this lesson, you will be able to:

Enhance tables using append structures

Enhance tables using Customizing Includes

Table Enhancements

Figure 24: Enhancements to the ABAP Dictionary – Overview Diagram

The figure shows the enhancements to the repository objects defined in the ABAP Dictionary in the SAP standard software.

Table Enhancements – Overview

Characteristics of the append structures are as follows:

Customers can create an append structure for an SAP table, without SAP preparation.

You can use multiple append structures with a single SAP table.

You can use them as normal structures in programs.

Characteristics of the Customizing Includes are as follows :

SAP has already integrated them into SAP tables.

The customer fills them with the desired additional fields.

They may contain source code or screen exits provided by SAP for processing or displaying these fields.

You can add extra fields to an SAP table, without modifying the table, using an append structure and Customizing Include.

You can expand tables and structures in one of following ways:

Using append structures

Append structures allow you to attach fields to a table without actually having to modify the table itself. They allow you to add customer-specific fields to any table or structure you want.

Append structures are created for use with a specific table.

Using Customizing Include

If the SAP application developer knows in advance that one of the tables or structures delivered by SAP needs to have customer-specific fields added to it, the developer includes these fields in the table using a Customizing Include statement.

Unlike append structures, you can use the same Customizing Include in multiple tables or structures. This ensures consistency throughout the tables and structures affected, whenever the include is altered.

Lesson: Enhancing Tables Using Append Structures and Customizing Includes

© Copyright . All rights reserved. 39

Append Structures

Figure 25: Append Structures

The characteristics of append structures are as follows:

Whenever you activate a table, the system searches for all active append structures for the table and attaches them to the table.

If you activate an append structure after creating or changing it, the table it is assigned to is also activated, and all changes made to the append structure take effect in the table as well.

The usage of the fields in append structures in ABAP programs is similar to that of any other field in the table.

If you copy a table that has an append structure attached to it, the fields in the append structure become normal fields in the target table.

Append Structures at Upgrade

Figure 26: Append Structures at Upgrade

You create append structures in the customer namespace. This protects them from being overwritten at upgrade or during release upgrade. New versions of standard tables will be

Unit 3: Enhancement of Dictionary Elements

loaded during upgrades. When these new standard tables are activated for the first time, the system appends fields contained in the active append structures to the new standard tables.

From Release 3.0, the field sequence in ABAP Dictionary can differ from the one in the database. Therefore, no conversion of the database table is necessary when adding an append structure or inserting fields into an existing one. Adjusting the database catalog, ALTER TABLE, takes care of all necessary structure adjustments automatically. When the table is activated in ABAP Dictionary, the system changes the table’s definition and appends the new field to the database table.

Pay attention to the following points when using append structures:

You cannot create append structures for pool and cluster tables.

If a table contains a long field (either of the LCHR or LRAW data type), you cannot expand the table using an append structure. This is because long fields of this kind must always be the last field in their respective tables. You may not add any fields from an append

structure after the long field.

If you use an append structure to expand an SAP table, the field names in your append structure must be in the customer namespace, that is, they must begin with either YY or ZZ. This prevents naming conflicts with any new fields that SAP may insert in the future.

Demonstration: How to Enhance a Table Using Append Structures The steps to enhance a table using an append structure are as follows:

1. Create an append structure named “ZASFLIGHT00” for table SFLIGHT00. The data will be entered later.

2. Create a field named “ZZMEAL”, referencing data element s_meal.

3. Activate your append structure.

4. Create another field with a name not starting with ZZ or YY.

5. Make a syntax check.

Emphasize that the database table does not recognize the append structure. For the database, it is only one table.

6. Start the SAPBC_TOOLS_TABLE_COPY program with the Fill Append fields only option selected, to fill the participants’ and your append fields.

You will need this data for the screen exit.

Lesson: Enhancing Tables Using Append Structures and Customizing Includes

© Copyright . All rights reserved. 41

Customizing Includes

Figure 27: Customizing Includes

Customizing Includes are part of the customer namespace. All of their names begin with

“ CI_”. With this naming convention, the nonexistent Customizing Includes do not lead to errors. The SAP standard software does not deliver any code for Customizing Includes.

You create Customizing Includes using special Customizing transactions. Some are already part of SAP enhancements and you can create them by using Project Management.

The Customizing Include field names must lie in the customer namespace, just like field names in append structures. These names must all begin with either YY or ZZ.

The rules of adding the fields of Customizing Include to your database are the same as those for append structures.

Demonstration: How to Enhance a Table Using Customizing Includes The steps to enhance a table using Customizing Include are as follows:

1. Show the aufk table to the participants.

2. Scroll down and show them Customizing Include ci_aufk.

3. Double-click ci_aufk.

You see that the include structure does not exist yet.

4. Create it and activate it.

5. Show the where-used list for ci_aufk to the participants.

Unit 3: Enhancement of Dictionary Elements

Unit 3

Exercise 2