‎2006 Jan 27 6:50 AM
can any one tell me diffrence between USING and CHNAGING.
whether USING a (or) CHANGING a are equevalent?
‎2006 Jan 27 7:10 AM
hi PRSHANTH,
Hope you dint look at my eaerlier reply..
ie..
if you pass a value as CHANGING VALUE()..
the change is not reflected within the FORM ..ENDFORM for the actual parameter.. ie in case you call another PERFORM like follows..
b=5.
PERFORM a CHANGING B.
FORM a CHANGING VALUE(B)
b=10.
PERFORM C.
ENDFORM.
FORM c.
write : /b.
endform.
......
now
in the form c.
the value of b is still unchanged since the endform of FORM a is still encountered..
‎2006 Jan 27 6:52 AM
i am not asking the result. i want to know the way they are processing. i.e. by reference or by value and return?
‎2006 Jan 27 6:52 AM
USING is that you are using a parameter but not trying to changfe the value.
CHANGING is that the parameter value can be changed.
‎2006 Jan 27 6:54 AM
You can pass both USING and CHANGING parameter as either pass by value or by reference.
But it depends on how you should use it.
Use USING if you dont want to read the values not to change them.
‎2006 Jan 27 7:27 AM
hi prasanth,
see there r 3 types of psaaing rt
1.pass by value
2. pass by reference
3. pass by value and return
1.using value(a)----
this is pass by value
2.using (a) or changeing (a) -
this is pass by reference
3. changing value(a) -
this is pass by value and return.
pass by value and return -
this is pass by reference only if u dont exit from the subrotune expicitly. means if inside the form, there is exit statement or any other statement which forcibly returns from the control from the form with out reaching the end of the form, then it acts as pass by value else it acts as pass by refernce.
‎2006 Jan 27 6:53 AM
hi,
they are not same.
suppose take...
using a
you cannot modify a value.
changing a.
you can modify the value of a. inside the perform.
regards
vijay
‎2006 Jan 27 6:55 AM
USING p_name1
values are initial,after changing value will not be affected
CHANGING p_name2
values may or may not be initial,after changing the value gets affected
‎2006 Jan 27 6:55 AM
Hi prashanth,
1. Good Question.
2. Theoretically, their
PURPOSE is different.
3. BUT
We can even use them INTER-CHANGE ABLY
4. Changing is meant for changing purpose.
5. But even in USING u can change the values !
regards,
amit m.
‎2006 Jan 27 6:56 AM
USING and CHANGING..works almost the same ..as call by refernce..except that in using..
1. you can pass the value by VALUE() addition to keep the original value unchanged.
2. in CHANGING if you pass it as VALUE() ..the value remains unchanged until it encounters an endform statement.. but gets changed when the value is returned..
which we call as <b>pass by value and result</b>.
‎2006 Jan 27 6:58 AM
HI prashant.
Using and Changing has the same effect when it is passed by reference.
During call by value.
USING pass the value of the variable. it will act as a local variable in the form. the change will not affect the passed value outside the form.
Changing will change the value in both the methods but the change will not occur untill endform
Message was edited by: Harikishore Sreenivasulu
Message was edited by: Harikishore Sreenivasulu
‎2006 Jan 27 7:05 AM
hi friends,
thanks for u r answers,but still i had one doubt.
changing value(a) and changing a are effected same way.
then which one to use when. explain according to memory issues.
‎2006 Jan 27 7:06 AM
Use changing value(a) when you want to pass by value. And the value is reflected on ENDFORM. Use Changing a when you want to call across programs.
‎2006 Jan 27 7:10 AM
hi PRSHANTH,
Hope you dint look at my eaerlier reply..
ie..
if you pass a value as CHANGING VALUE()..
the change is not reflected within the FORM ..ENDFORM for the actual parameter.. ie in case you call another PERFORM like follows..
b=5.
PERFORM a CHANGING B.
FORM a CHANGING VALUE(B)
b=10.
PERFORM C.
ENDFORM.
FORM c.
write : /b.
endform.
......
now
in the form c.
the value of b is still unchanged since the endform of FORM a is still encountered..
‎2006 Jan 27 7:16 AM
Hi
regarding how it shares memory refer this
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db984635c111d1829f0000e829fbfe/content.htm
‎2006 Jan 27 10:42 AM
hi prashanth,
the use of USING & CHANGING depend on the program's requirement.e.g when there is a need for passing two parameters & calculating or manipulating some other , then u go for USING . whereas sometimes u require to change a parameter based on some other condition then u have to go for CHANGING . Both can be passed by value & by reference depending upon the scope of the logic.