You can generate the getter and/or setter method stubs from an attribute in the definition of an ABAP class in the implementation. In addition, the corresponding importing and/or returning parameter(s) are set.
Example
Before Execution | After Execution |
---|---|
|
|
In the local cl_car class of an ABAP program, the speed attribute is defined. For the latter, the getter and setter methods and the corresponding returning and importing parameters need to be generated. The reason for this is because their value should be accessed and encapsulated. |
In the definition part of the cl_car class, the get_speed and set_speed methods are added. For the get_speed method, the r_speed returning parameter is set and for the set_speed method the i_speed importing parameter is set. In the implementation part, the corresponding method stubs and their returing and importing parameters are generated on the basis of the selected attribute. |