You can generate a code snippet for the method implementation and its redefinition in
one step.
Prerequisites
This functionality is provided for SAP NetWeaver 7.5 SP04 and
higher.
Context
You want to override or extend a method from a superclass.
Procedure
- In the implementation of an ABAP class, you can add the relevant code snippet at the
following positions:
- If the class does not yet contain any methods, position the cursor
between the CLASS implementation and
ENDCLASS statement.
- Otherwise, position the cursor between the
- CLASS implementation and
METHOD statement
- ENDMETHOD and METHOD
statement
- ENDMETHOD and ENDCLASS
statement
- Trigger code completion choosing Ctrl + Space.
A list with all methods that can be overridden is displayed.
Figure 1:
List that displays the superclass methods that can be overridden, triggered by code
completion
- Choose the relevant method.
Results
The relevant method implementation, together with its redefinition, is added to your ABAP
class. Its visibility is the same as the corresponding definition of the
superclass.
Figure 2:
Example of an ABAP class that now contains the redefinition and the method block of an
inherited method from the superclass
Note
The supercall is not added by default.
If you want to keep the behavior of the method as it is defined in the superclass, you have
to add the supercall to the corresponding method implementation manually.