Meaning of CHANGING < Var>
in subroutine call
Could any tell me the meaning of CHANGING < Var> in
subroutine call.
Whats the meaning and use of Changing in above sentence ? Sunita
"using Var1" doesn't reflect any
changes that we made to Var1 in the subroutine. But "changing Var2" reflects
the changes we made to Var2.It is similar to the concept call by value
and call by reference.
form subroutine using a1 changing
a2.
then the values of v1 = 10 v2 =40. Hope u understood... Ravikumar Kandikonda
There will be difference between using and changing on how we mention in form statement. Form < subroutine name> Using var1 Changing var2.
Form < subroutine name> Using var1 Changing value (var2).
Form ..... Using value(var1)...
Arvind C
Here is some brief idea about the addition USING and CHANGING in forms. If a subroutine has a parameter interface, you must supply values to all of the formal parameters in its interface when you call it. You list the actual parameters after the USING or CHANGING addition in the PERFORM statement. When you pass the values, the sequence of the actual parameters in the PERFORM statement is crucial. The value of the first actual parameter in the list is passed to the first formal parameter, the second to the second, and so on. The additions USING and CHANGING have exactly the same meaning. You only need to use one or the other. However, for documentary reasons, it is a good idea to divide the parameters in the same way in which they occur in the interface definition. Actual parameters can be any data objects or field symbols of the calling program whose technical attributes are compatible with the type specified for the corresponding formal parameter. When you specify the actual parameters, note that any that you pass by reference to a formal parameter, and any that you pass by value to an output parameter, can be changed by the subroutine. You should therefore ensure that only data objects that you want to be changed appear in the corresponding position of the actual parameter list. So there is absolutely no difference in the additions USING and CHANGING.. then you may be thinking why the hell did SAP provide both.. the answer is just for the sake of better documentation.. So whenever you write a subroutine its better to give USING only for those parameters which u wont be changing in the subroutine and CHANGING only for those parameters which u'll be definetly changing or updateing or returning the value to the called program This really helps the person who is looking at your code... Cheers Basha
See Also:
More Function Module
Tables
ABAP Books List
Smart Forms
ABAP Menu:
Return to Index:-
(c) www.gotothings.com All material on this site is Copyright.
|