
In a source code-based development object, you can delete unused variables in the entire object or only in marked source code. This enables you to automatically find and delete unused variable declarations in order to clean up source code.
This function deletes the following types of unused variables:
You can undo the deletions using the shortcut Ctrl Z.
Example
CLASS cl_car_unused_variable DEFINITION PUBLIC.
PUBLIC SECTION.
METHODS drive IMPORTING i_speed TYPE i.
ENDCLASS.
CLASS cl_car_unused_variable IMPLEMENTATION.
METHOD drive.
DATA: speed TYPE i,
max_speed TYPE i.
speed = 50.
ENDMETHOD.
ENDCLASS.The unused variable declarations of the selected section are removed and its lines are highlighted with a marker in the ruler. The marker disappears after you have saved or checked the syntax.
Example
ABAP class after deleting:
CLASS cl_car_unused_variable DEFINITION PUBLIC. PUBLIC SECTION. METHODS drive IMPORTING i_speed TYPE i. ENDCLASS. CLASS cl_car_unused_variable IMPLEMENTATION. METHOD drive. DATA: speed TYPE i. speed = 50. ENDMETHOD. ENDCLASS.