Changing and Using are pass by reference only but the difference is:
When you use USING the value which you assign as a Formal value will
not effect the Actual value.
But when we use CHANGING - The Formal value will overwrite on the Actual
value.
Formal value is the value which you assign in the Subroutine.
It creates the copy of the VARIABLE.
Actual value is the value which you assign outside of the Subroutine.
EX: DATA V TYPE I VALUE 20 .
(HERE V = 20 IS AN ACTUAL VALUE .)
WRITE V .
*PERFORM ABC USING V .
PERFORM ABC CHANGING V .
WRITE V .
*FORM ABC USING P_V .
FORM ABC CHAGING P_V .
P_V = 10 .
WRITE P_V .
ENDFORM .
HERE THE OUTPUT COMES LIKE THIS FOR USING .
20
10
20.
OUTPUT FOR CHANGING.
20
10
10
While USING the VARIABLE value stores in a copy of the ACTUAL VARIABLE'S
.
When you use CHANING it STORES in the address of the ACTUAL VARIABLE
.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin