Passing by VALUE:
a. Create a different memory allocation between the formal and actual parameters. Formal parameters are the variable owned by a method or functions or forms. While, actual parameters are the variables that will be holding the value of the formal parameters inside a method, etc.
Ex: (V1 is the actual parameter while p_v1 is the formal parameters)
PERFORM f_form USING V1 TYPE string.
:
:
FORM f_form USING p_v1 TYPE string.
ENDFORM.
b. Moving a value into a formal parameter has no effect in the value of the actual parameter. Treat them as an independent variables.
Passing by REFERENCE:
a. Formal and actual variables share a common memory allocation
b. Whatever value will be moved to formal parameters will be the value also of the actual parameter and vice-versa.
By default, methods pass the value by reference. But, the best practice and by not breaking the property of a method, it is advisable to pass a parameter by value to avoid initialization problem later on.
There are though various techniques on how to utilize this parameter passing. Putting brackets with a by reference or by value ABAP statement addition may change its purpose.
No comments:
Post a Comment