
You can create an attribute, local variable, or a parameter (importing, returning, changing, or exporting) on the basis of a usage in a method implementation.
Example
The variable speed is used but not yet declared:
CLASS cl_car DEFINITION. PUBLIC SECTION. METHODS drive. PRIVATE SECTION. ENDCLASS. CLASS cl_car IMPLEMENTATION. METHOD drive. speed = 50. ENDMETHOD. ENDCLASS.
In the private section, the attribute (speed) is added and declared.
Example
ABAP class after extraction:
CLASS cl_car DEFINITION. PUBLIC SECTION. METHODS drive. PRIVATE SECTION. DATA: speed TYPE i. ENDCLASS. CLASS cl_car IMPLEMENTATION. METHOD drive. speed = 50. ENDMETHOD. ENDCLASS.