What does it do? Apart from the addition EXCEPTIONS>, these additions assign actual parameters a1 a2...> to the formal parameters p1 p2 ...> or r> of the parameter interface of the called method. Any data objects (and some expressions) can be specified as actual parameters if their data type matches the typing> of the corresponding formal parameter in accordance with the rules of the typing check>. With the exception of the return value r> for functional methods> and the specification of arithmetic expressions for input parameters, every formal parameter inherits all properties of the assigned actual parameters when called. Non-class-based exceptions can be handled using the addition EXCEPTIONS>. The order of the additions is fixed.
Latest notes:
The formal parameters and non-class-based exceptions of a method are defined as its parameter interface > using the additions of the statements METHODS>> or CLASS-METHODS> > of global or local classes.
Unlike function module calls>, static parameter passing is checked by the syntax check and not just by the extended program check. NON_V5_HINTS
A system field> should never be used as an actual parameter>. ABAP_HINT_END • EXPORTING ABAP_METHOD_CALL • EXPORTING CALL METHOD
ABAP Addition
What does it do? This addition assigns actual parameters to the input parameters> of the called method. EXPORTING> can be used to assign actual parameters to the optional input parameters and it must be used to assign actual parameters to the non-optional input parameters. In pass by reference>, a reference to an actual parameter is passed when the call is made. In pass by value>, the content of an actual parameter is assigned to the relevant formal parameter. a1>, a2>, ... are general expression positions>, which means that, in addition to data objects, functions and expressions can also be passed as actual parameters. Special rules> apply in this case.
Latest notes:
No substring access> is possible after an actual parameter of type string> or xstring> specified after EXPORTING>.
The addition EXPORTING> can also be omitted in the short form> of the static method call. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Calls of a method with passing of actual parameters to input parameters. The first call is the syntax short form of the second call. Both have the same functionality. ABEXA 00070 ABAP_EXAMPLE_END • IMPORTING ABAP_METHOD_CALL • IMPORTING CALL METHOD
ABAP Addition
What does it do? This addition assigns actual parameters to the output parameters> of the called method. IMPORTING> can be used to assign actual parameters to all output parameters, but this is not mandatory. In pass by reference>, a reference is passed to an actual parameter when the call is made. In pass by value>, the content of an output parameter is assigned to the relevant actual parameter only if the method is completed without errors. The actual parameters are result positions>, which means that variables and writable expressions> can be specified. Special rules> apply in this case.
Existing variables or writable expressions can be specified as actual parameters for functional method calls >. Inline declarations, however, cannot be specified.
Inline declarations DATA(var)>> or FINAL(var)>> can also be specified for standalone method calls >. If an inline declaration is specified and a formal parameter is completely typed, this type is used for the declaration. If the formal parameter is typed generically, the following data types are used:
string> for csequence> and clike>
xstring> for xsequence>
decfloat34> for numeric> and decfloat>
p> with the length 8 and no decimal places if p> is generic
The standard key> for a standard table type with a generic primary table key Other generic data types cannot be specified correctly for inline declarations and produce a syntax error.
Latest notes:
If a formal parameter is typed with the generic type c> or x >, for example, string> or xstring> cannot be used as the type for an inline declaration, since the typing cannot be checked.
Functional method calls are on the right side of assignments or are part of expressions where no inline declarations are possible. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 The method GET_DOCU> of the class CL_ABAP_DOCU_ITF> has two input parameters and two output parameters, as well as a return value that indicates whether the method was executed successfully. Functionally>, the method is called as an operand of a comparison expression> in a logical expression. The values in the output are reused in further method calls only if the method completed successfully. ABEXA 00071 ABAP_EXAMPLE_END • CHANGING ABAP_METHOD_CALL • CHANGING CALL METHOD
ABAP Addition
What does it do? This addition assigns actual parameters to the input/output parameters> of the called method. CHANGING> can be used to assign actual parameters to the optional input/output parameters and it must be used to assign actual parameters to the non-optional input/output parameters. In pass by reference>, a reference to an actual parameter is passed when the call is made. In pass by value>, the content of an actual parameter is assigned to the relevant formal parameter. In pass by value>, the modified content of an input/output parameter is assigned to the relevant actual parameter only if the method is completed without errors. The actual parameters are result positions>, which means that variables and writable expressions> can be specified. Special rules> apply in this case.
ABAP_EXAMPLE_VX5 Call of a method with an input/output parameter. ABEXA 00072 ABAP_EXAMPLE_END • RECEIVING ABAP_METHOD_CALL • RECEIVING CALL METHOD
ABAP Addition
What does it do? This addition assigns an actual parameter to the return value> of the called method. It is only possible for standalone method calls> and not for functional method calls>. An actual parameter can be assigned to the return value of a functional method> using RECEIVING>. The data type of the actual parameter does not have to follow the general rules of the typing check > and it is sufficient if the return value can be converted to the actual parameter in accordance with the conversion rules>. If the method is completed without errors, the content of the formal parameter is assigned to the actual parameter. The content is converted if necessary. If an exception is raised here, it cannot be handled and a runtime error always occurs instead. The actual parameter is a result position>, which means that variables and writable expressions> can be specified. Special rules> apply in this case. An existing variable or expression or an inline declaration DATA(var)>> or FINAL(var)>> can be specified as an actual parameter. An inline declaration is made as soon as the data type of the return value is fully known.
Latest notes: The addition RECEIVING> is not usually used for static method calls. A functional method with a return value is not usually called as a standalone method call> but as a functional method call> in operand positions> instead. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Calls of a functional method with return value. The first call is the usual functional method call>. The second call demonstrates the unusual use of the addition RECEIVING >. The result is the same in both cases. ABEXA 00073 ABAP_EXAMPLE_END • EXCEPTIONS ABAP_METHOD_CALL • OTHERS ABAP_METHOD_CALL • EXCEPTIONS CALL METHOD • OTHERS CALL METHOD
ABAP Addition =n_others$]>
What does it do? This addition is only possible for standalone method calls> and not for functional method calls>.