Hi all,
Please check the two codes and tell me what wrong in the first code.
This both codes are from SDN experts
data : num1 type i ,
num2 type i.
num1 = 7.
num2 = 10.
perform find_sum using num1 num2.
write / : num1 , 'out put will be 7 itself'.
*********changing**********
perform find_sum1 changing num1 num2.
write / : num1 , 'out put will be 17 '.
form find_sum using p_num1 type i
p_num2 type i.
p_num1 = p_num1 + p_num2.
endform. " find_sum
form find_sum1 changing p_num1 type i
p_num2 type i.
p_num1 = p_num1 + p_num2.
endform. " find_sum
This is what i see an output,
17 out put will be 7 itself
27 out put will be 17
ACTUAL IT SHOULD BE LIKE THIS RIGHT
7 out put will be 7 itself
17 out put will be 17
but when i do this
DATA : num1 TYPE i ,
num2 TYPE i.
num1 = 7.
num2 = 10.
PERFORM find_sum USING num1 num2 .
WRITE / : num1 , 'out put will be 7 itself'.
*********changing**********
PERFORM find_sum1 CHANGING num1 num2.
WRITE / : num1 , 'out put will be 17 '.
&----
*& Form find_sum1
&----
text
----
<--P_NUM1 text
<--P_NUM2 text
----
FORM find_sum1 CHANGING p_num1 TYPE i
p_num2 TYPE i.
p_num1 = p_num1 + p_num2.
ENDFORM. " find_sum1
&----
*& Form find_sum
&----
text
----
-->P_NUM1 text
-->P_NUM2 text
----
FORM find_sum using value(p_num1) p_num2 .
p_num1 = p_num1 + p_num2.
ENDFORM. " find_sum
it gives the result what iam looking for and it in accordance to definiation of the using and changing
Here the o/p his
7 out put will be 7 itself
17 out put will be 17
My question is what wrong with the first code
Thanks again