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

Difference between pass by value & pass by value and result

Former Member
0 Likes
692

hi friends,

could anyone please send the 1. difference between pass by value & pass by value and result with example.

2.we can create 9 internal session in a external session how ? i confused.

thanks & regards

subrat

hi friends,

could anyone please send the 1. difference between pass by value & pass by value and result with example.

2.we can create 9 internal session in a external session how ? i confused.

thanks & regards

subrat

2 REPLIES 2
Read only

Former Member
0 Likes
559

For Internal and Main sessions read the below link

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb2d40358411d1829f0000e829fbfe/content.htm

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.

Example to make you understand better.

REPORT zkartest.

PARAMETER: test(2) TYPE c.

PERFORM change_test1 USING test.

WRITE:/ test.

PERFORM change_test2 USING test.

WRITE:/ test.

&----


*& Form change_test1

&----


  • Value of test will change here. Pass by REFERENCE

----


  • -->P_TEST text

----


FORM change_test1 USING p_test.

p_test = p_test + 2.

WRITE:/ p_test.

ENDFORM. "change_test1

&----


*& Form change_test2

&----


  • Value of test will change here but only in the subroutine. Pass by VALUE

----


  • -->VALUE(P_TEST) text

----


FORM change_test2 USING value(p_test).

p_test = p_test + 2.

WRITE:/ p_test.

ENDFORM. "change_test2

-Kiran

*Please reward useful answers

Read only

Manohar2u
Active Contributor
0 Likes
559

1. Pass by value and pass by reference ( getting result )

a) Pass by value

<b>PERFORM subr USING a1 a2 a3 a4 a5</b>

Click for example <a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db979d35c111d1829f0000e829fbfe/frameset.htm">Passing Parameters to Subroutines</a>

b) Pass by reference

<b>PERFORM subr CHANGING a1 a2 a3 a4 a5</b>

Click for example <a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/db979035c111d1829f0000e829fbfe/frameset.htm">Example of Passing Parameters by Reference</a>

2. If you do <b>call transaction</b> from a program it will create an internal session. or creating sessions programatically are called as internal sessions.

Regds

Manohar

Manohar