Enhancement Framework 联系客服

发布时间 : 星期日 文章Enhancement Framework更新完毕开始阅读ac6da9075fbfc77da369b141

?? are switchable by the switch framework; ?? fewer upgrade effort.

Disadvantages of source code enhancements:

?? exist only at special source code lines (implicit, explicit).

For more information about the usage of source code enhancements, see:

Implicit Enhancement Options in ABAP Source Codes Explicit Enhancement Options in ABAP Source Codes Creating Source Code Plug-Ins

Implicit Enhancement Options in ABAP Source Codes

Use

In ABAP programs, implicit enhancement options are predefined at the following places:

? At the end of an include. There are some restrictions, for example, not at the end of a

method include.

? At the end of a PUBLIC-, PROTECTED-, PRIVATE-SECTION of a class.

? At the end of the implementation part of a class (before the ENDCLASS, which belongs

to CLASS … IMPLEMENTATION).

? At the end of an interface definition (before the ENDINTERFACE).

? At the end of a structure definition (before TYPES END OF, DATA END OF, CONSTANTS

END OF, and STATICS END OF).

? At the beginning and at the end of a procedure (FORM, FUNCTION, METHOD). That is,

after commands FORM, FUNCTION, and METHOD, and before statements ENDFORM, ENDFUNCTION, and ENDMETHOD.

? At the end of the CHANGING-, IMPORTING-, EXPORTING-parameter list of a method.

These enhancement options are located in the middle of a statement.

Implicit enhancement options always exist and no enhancement spot is assigned to them.

Activities

The implicit enhancement options can be displayed in the ABAP Editor by following the path: Edit ? Enhancement Operations ? Show Implicit Enhancement Options, and then enhanced using source code plug-ins.

Explicit Enhancement Options in ABAP Source Codes

Use

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.

An explicit enhancement option of an ABAP program is part of the program. It is thus assigned to the package of the program and not necessarily to the package of the enhancement spot to which it belongs.

Activities

To mark a position in an ABAP program as an explicit enhancement option, use the

following ABAP statement:

ENHANCEMENT-POINT enh_id SPOTS spot1 spot2 ...

?? To mark a section in an ABAP program as an explicit enhancement option, use the

following ABAP statement:

ENHANCEMENT-SECTION enh_id SPOTS spot1 spot2 ... ...

END-ENHANCEMENT-SECTION.

Using enh_id, you define the name of the enhancement option or the source code enhancement. After SPOTS, the enhancement option must be assigned to at least one (simple) enhancement spot. For a detailed description of the statements, refer to the ABAP keyword documentation.

An enhancement spot for source code enhancements is created using forward navigation from within the ABAP Editor. The statements can either be entered directly or generated by selecting Enhancements ? Create Enhancement.

After the program has been saved, the enhancement option is managed by the Enhancement Builder, and can only be deleted using the function Enhancements ? Remove Enhancement.

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.

Creating Source Code Plug-Ins

Procedure

... 1. Call the Enhancement Builder from the ABAP Editor using forward navigation.

2. Create an enhancement implementation for an implicit or explicit enhancement

option. For more information, see Creating an Enhancement Implementation. An empty source code plug-in is automatically created. It has a unique ID and is displayed in the ABAP Editor below the enhancement option as follows: ENHANCEMENT id. ...

ENDENHANCEMENT.

3. Implement the enhancement between the ENHANCEMENT and ENDENHANCEMENT

lines.

A source code plug-in is assigned to exactly one enhancement option. An enhancement option can be enhanced through several source code plug-ins of an enhancement implementation and through several enhancement implementations.

Although source code plug-ins are displayed in the same source code as the respective enhancement options, they are actually stored in other Include programs managed by the Enhancement Builder.

Function Module Enhancements

Use

The function module enhancements can be separated into:

? Source code enhancements – Enhancements to the source code are carried out by

means of ABAP source code enhancements.

? Parameter interface enhancements – You can enhance the parameter interface of a

function module with new, optional formal parameters as enhancement implementation elements. For more information, see Enhancing Parameter Interfaces.

Enhancing Parameter Interfaces

Use

You can enhance the parameter interface of a function module with new, optional formal parameters as enhancement implementation elements. Enhancing by adding new exceptions is not possible.

In the context of the enhancement concept, the parameter interface of a function module provides corresponding enhancement options.

Procedure

To implement an enhancement of the interface, use the Function Builder to call the Enhancement Builder:

... 1. Choose the tab of the parameter type for which you want to insert a formal

parameter.

2. Choose Edit ? Enhancement Operations ? Enhance Interface for a function

module.

A dialog box appears.

3. Select an existing enhancement implementation or create a new one (see

Creating an Enhancement Implementation).

This takes you to the enhancement mode of the Function Builder in which the original components of the function module are displayed and cannot be changed.

4. Insert the new formal parameter in the same way as when you create a function

module.

5. Save and activate the function module.

The new parameter can now be used at implicit and explicit enhancement options in enhancements to the source code of the function module. This can be done using ABAP source code enhancements.

Enhancements to Global Classes and Interfaces

Use

The enhancements to global classes and interfaces can be separated into:

● Enhancements to the source code of methods, local classes, and so on – these

enhancements are carried out by means of ABAP Source Code Enhancements.

● Enhancements to components of classes and interfaces

Enhancements to Components of Classes and Interfaces

You can enhance the components of a global class or global interface by:

● Inserting new attributes

● Inserting new, optional formal parameters for existing methods (but no new exceptions)