In a method of an ABAP class, you can create a new variable on the basis of an expression. This means, the tool adds a new local variable and assigns the expressions. Note that other occurrences of the same expression are not replaced with the new variable.
Example
Before Execution | After Execution |
---|---|
To copy the source code example, click here Code Example Before Execution |
|
The expression i_speed * '1.6' is to be extracted into a new local variable. | In the implementation part of the method, the new local variable (kmh) is defined. The expression is assigned to the new local variable. In the speed statement, the expression is replaced with the new variable. |