Show TOC

 Creating Parameters for MethodsLocate this document in the navigation structure

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.

Note

When you redefine inherited methods, you may not change the signature.

Procedure
  1. Open the class or interface.
  2. Choose Methods.
  3. Position the cursor on the name of the method or event.
  4. Choose Parameters.
  5. 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.

    Note

    If you use changing parameters, you cannot use returning parameters. If you use returning parameters, you cannot use exporting or changing parameters. Constructor methods use only exporting parameters.

    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:

Implementing Methods .