
An existing constant is already defined for the same literal in a certain ABAP class.
You can reuse a member or local constant that has already been generated.
Note that all occurrences of the same literal remain unchanged.
Example
The literal '200' is to be replaced with an existing constant:
CLASS cl_car DEFINITION.
PUBLIC SECTION .
METHODS: drive
IMPORTING
i_speed TYPE i.
PRIVATE SECTION .
CONSTANTS max_speed TYPE i VALUE 220.
DATA: current_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF i_speed > 220.
current_speed = 220.
ELSE.
current_speed = i_speed.
ENDIF.
ENDMETHOD.
ENDCLASS.In the source code of the ABAP class, all occurrences of the literal are replaced with the name of the existing constant.
Example
ABAP class after reusing an existing constant:
CLASS cl_car DEFINITION.
PUBLIC SECTION .
METHODS: drive
IMPORTING
i_speed TYPE i.
PRIVATE SECTION .
CONSTANTS max_speed TYPE i VALUE 220.
DATA: current_speed TYPE i.
ENDCLASS.
CLASS cl_car IMPLEMENTATION.
METHOD drive.
IF i_speed > max_speed.
current_speed = max_speed.
ELSE.
current_speed = i_speed.
ENDIF.
ENDMETHOD.
ENDCLASS.