Creating Parameters for Methods
Use
You define methods for classes and interfaces similarly to the way you create function modules. First, you create interface parameters and exceptions and then you code (implement) the method. The input parameters include the Importing and Changing parameters. The output parameters can be Exporting, Changing and Returning parameters.
Prerequisites
The method for a class or interface already exists.
Procedure
- Open the class or interface.
- Choose Methods.
- Position the cursor on the name of the method or event.
- Choose Parameters.
- To define parameters of methods or events, enter the following information:
Option Description Parameter
A unique name for the parameter. You need to observe the naming conventions for the parameters that are local to the method under ABAP Objects.
Category
The possible values are Importing, Exporting, Changing or Returning.
Value Transfer
In contrast to function modules, parameters for methods are passed by reference. However, by selecting this option you can force the system to pass a parameter by value. This is only possible for importing, exporting, and changing parameters. Returning parameters can be passed only by value.
Optional
If you select this option, the parameter does not have to be specified when the method is called.
Typing Method
ABAP keyword for defining the type reference. You can use TYPE, LIKE, and TYPE REF TO.
Reference Type
You can use any elementary ABAP type (including generic types) or object type (classes and interfaces). For more information, see Data Types in the ABAP User Guide.
Parameters can also be defined with data types for the specific classes when using private and protected methods.
Default Value
Default value for the parameter
Description
Short description of the parameter
Result
You have defined interface parameters and can now implement the method.
See also: