Show TOC Start of Content Area

Background documentation Enhancement Concept  Locate the document in its SAP Library structure

Definition

The Enhancement Framework provides a technology for enhancing source code units without modifying them. The basic mechanism is to offer the so-called enhancement options in development objects. These enhancement options function like “hooks” where you can attach your enhancements. The enhancement options are part of the development objects which can be enhanced. When you assign an enhancement to an enhancement option, at runtime the enhancement is processed when the control flow reaches the option. At runtime the enhancement behaves as if it belongs to the development object it enhances, while the enhancement as a transport object does not belong to the enhanced object.

Basic Concepts

The basic concepts in the Enhancement Framework are:

      Enhancement options: positions in repository objects where you can make enhancements. Enhancement options can be explicit and implicit.

      Enhancement spots: containers for explicit enhancement options.

      Enhancement implementation elements: these contain the actual enhancement, for example, the source code to be added.

      Enhancement implementations: containers for both enhancement implementation elements of both implicit and explicit enhancement options.

The enhancement options are divided into two classes:

      Implicit enhancement options are provided by the framework and exist without any particular preparation by a developer, they do not have to belong to a container (an enhancement spot).

      Explicit enhancement options have to be inserted explicitly in the source code. They are created in an initial system and must be made known to developers in target systems by means of enhancement spots.

The figure below shows an overview of enhancement spots and enhancement implementations. The left part shows the relevant terminology for enhancement spots and the relationships between them. It only applies to explicit enhancement options. No enhancement spots are required for implicit enhancement options.

The right part shows the relevant terminology for enhancement implementations and the relationships between them. This applies to enhancement implementations of both explicit and implicit enhancement options.

On the implementation side, all implementation elements, regardless of whether they enhance implicit or explicit enhancement options belong to other containers. The containers on the definition side and those on the implementation side are assigned to each other with a particular cardinality.

This graphic is explained in the accompanying text

Grouping Enhancements

Enhancement options and their implementations must not be grouped together as they belong to different stages of development. In the Enhancement Framework there are containers for the enhancement options on the definition side and containers for the implementations on the implementation side:

·         Simple containers

These can only contain enhancement options or enhancement implementation elements. These containers cannot be nested. One basic container can only hold elements of one type. For example, a simple container cannot hold BAdIs and enhancement options at the same time.

·         Composite containers

To make room for a nested structure there are composite containers that can hold basic containers and other composite containers. These composite containers can contain basic containers for different enhancement types. Since these composite containers can be nested, you can build a structure that really fulfills the needs of your project. A simple structure looks like this:

This graphic is explained in the accompanying text

When you create an enhancement from scratch, you always have to create the respective containers first. This is similar to creating a method. A method is always part of a class. In the same way, there is no standalone BAdI. Each BAdI is part of an enhancement spot and it is the spot that functions as a transport object. That is why you cannot build a new BAdI and just forget about the framework in the way you might be accustomed to with classic BAdIs. It is also not possible to build the BAdI first and take care of how it fits in the structure of containers later. When building a BAdI, you have to put the BAdI within the relevant structure from the very beginning. But it is only mandatory to have simple containers. Composite enhancements spots and composite enhancement implementations are not enforced by the tools.

Note

Note that after creating an enhancement spot and a simple enhancement implementation, you have only the containers but you still you have to create an enhancement option or the respective implementation.

 

 

End of Content Area