Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Abap Objects

Former Member
0 Likes
473

Hi All,

What is the differents between Pass by value and Pass by reference with simple Examples. Thanks in Advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
447

Hi vijay,

<b>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.</b>

3 REPLIES 3
Read only

Former Member
0 Likes
448

Hi vijay,

<b>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.</b>

Read only

Former Member
0 Likes
447

Hi,

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.

Examples:

Just have look at these links:

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_47x200/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/frameset.htm</a>

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db979035c111d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_47x200/helpdata/en/9f/db979035c111d1829f0000e829fbfe/frameset.htm</a>

Regards,

Gunasree.