Explicit Enhancement Options in ABAP Source Code
Definition
In ABAP programs, you can select either a position or a program section as an explicit enhancement option. Source code plug-ins for an enhancement are either entered at such a position or they replace the selected section.
Activities
To create an explicit enhancement option in the ABAP source code, proceed as follows:
- In the ABAP Editor, open the program you want to edit.
- Switch to change mode.
- In the source code, right click and choose Enhancement Operations → Create Option from the context menu.
The Create Enhancement Option dialog box appears.
- Choose between ENHANCEMENT-POINT and ENHANCEMENT-SECTION and specify a name for the type of enhancement option you have selected.
- Choose whether to include the enhancement option in the source code as a conditional or as an unconditional call. For more information, use F1 to open the ABAP Keyword Help.
- Create a new enhancement spot where to store your new enhancement option or choose an existing spot.
- Choose Enter.
Declaring Explicit Enhancement Options
A position in an ABAP program marked as an explicit enhancement option looks like that:
ENHANCEMENT-POINT <name> SPOTS <spot1> [<spot2>] [STATIC] ...
- Static enhancement statement - for example, additional data declaration
- Dynamic enhancement statement - for example, additional source code
A section in an ABAP program marked as an explicit enhancement option looks like that:
ENHANCEMENT-SECTION <name> SPOTS <spot1> [<spot2>] [STATIC]
...
END-ENHANCEMENT-SECTION.
- Static enhancement statement - for example, replace an existing data declaration
- Dynamic enhancement statement - for example, replace existing source code.
Data declarations are always static, even if they are inside a dynamic enhancement option. Form routines, methods, and local classes cannot be part of dynamic enhancement points and sections. You need to place them in static enhancement points or sections.
During program generation, the source code plug-ins that are in the current system for the assigned enhancement implementations and have the switch status stand-by or on, are included at this position or they replace the selected section.