ABAP Keyword Documentation → ABAP − Reference → Declarations → Declaration Statements → Classes and Interfaces → ABAP Objects - Overview → Classes → Components of Classes → Methods of Classes
Interface Parameters in Methods
The interface parameters in methods are input parameters
(IMPORTING
and CHANGING
parameters) and output parameters
(EXPORTING
, CHANGING
, and RETURNING
parameters). Declarations using the statements
define the following attributes:
Other versions: 7.31 | 7.40 | 7.54
Passing parameters by reference or by value
With the exception of the return value (RETURNING
parameters), parameters
can be passed both by value or by reference. Passing by reference is the default in methods. If only
a name p
is specified in the parameter declaration, the parameter is passed
implicitly as a reference. If VALUE(p)
is specified instead, the parameter
is passed as a value. The return value may only be passed as a value. Pass by reference can also be
specified explicitly in other parameters using REFERENCE(p)
. An IMPORTING
parameter passed by reference cannot be modified in the method.
Typing of Parameters
All parameters must be typed when declared using TYPE
or LIKE
additions.
Optional Parameters
All input parameters (IMPORTING
and CHANGING
parameters)
can be defined in the declaration as optional parameters using the additions OPTIONAL
or DEFAULT
. These parameters are then not always mandatory when the method
is called. The parameter remains initial and type-friendly when the addition OPTIONAL
is specified, whereas the addition DEFAULT
makes it possible to specify a
start value.