‎2008 Feb 13 9:55 PM
hey,
what difference makes if I pass the parameter by value vs pass by reference.
thanks.
- deepan
Edited by: Deepan Gunalan on Feb 13, 2008 10:57 PM
‎2008 Feb 14 12:36 AM
Pass by reference:
A way of passing data from actual parameters to formal parameters. When you pass by reference, no local data object is specified for the actual parameter, but the procedure receives a reference to the actual parameter during call and works with the actual parameter itself. A change to the formal parameter in the subroutine also changes the value of the actual parameter.
Pass by value:
a local object with the same data type as the corresponding actual parameter is created in the subroutine and filled with its values. A change to the formal parameter in the subroutine does not change the value of the actual parameter. The actual parameter also retains its original value even after the subroutine has ended.
Check this thread for sample program to understand better
‎2008 Feb 13 10:23 PM
Actual parameters can be any data objects or field symbols of the calling program whose technical attributes are compatible with the type specified for the corresponding formal parameter. When you specify the actual parameters, note that those you pass by reference to a formal parameter and those you pass by value to an output parameter can be changed by the subroutine. You should therefore ensure that only data objects that you want to be changed appear in the corresponding position of the actual parameter list.
ref:http://help.sap.com/saphelp_nw70/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/content.htm
‎2008 Feb 14 12:23 AM
‎2008 Feb 14 12:36 AM
Pass by reference:
A way of passing data from actual parameters to formal parameters. When you pass by reference, no local data object is specified for the actual parameter, but the procedure receives a reference to the actual parameter during call and works with the actual parameter itself. A change to the formal parameter in the subroutine also changes the value of the actual parameter.
Pass by value:
a local object with the same data type as the corresponding actual parameter is created in the subroutine and filled with its values. A change to the formal parameter in the subroutine does not change the value of the actual parameter. The actual parameter also retains its original value even after the subroutine has ended.
Check this thread for sample program to understand better