You can convert definitions of a local variable, local constant, or local type and paste them into the private section of the current class. Therefore, you can make certain local elements of individual methods available for all methods within an ABAP class.
Local Elements | Members |
---|---|
Local variables | Attributes |
Local constants | Member constants |
Local types | Member types |
Field symbols | Cannot be converted to members |
Example
Before Execution | After Execution |
---|---|
To copy the source code example, click here Code Example Before Execution |
|
The speed variable is declared local variable inside the implementation of the drive method. |
The local declaration has been removed and replaced by an attribute declaration. The attribute has been added to the private section. |