SAP METHOD PARAMETERS



Get Example source ABAP code based on a different SAP table
  



ABAP_OBJ - 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
METHODS
CLASS-METHODS
EVENTS
CLASS-EVENTS
define the following attributes:

Passing Parameters by Reference or by Value
With the exception of the return value (RETURNING parameters), parameters can be passed both by value and 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 then do not always have to be transferred when the method is called. The parameter remains initial and type-compliant when the addition OPTIONAL is specified, whereas the addition DEFAULT makes it possible to specify a start value.