‎2007 Oct 06 11:09 AM
in parameter passing, if USING and CHANGING serve the same purpose (see my previous post - ) and the only difference is when you use CHANGING you are going to do something with the formal parameter inside the FORM. Does this mean I cannot do operation (like addition if the formal parameter is an integer type) if USING is being used? i tried doing that and i used USING and surprisingly it allowed the operation. anyone can help me understand pls? <b>thanks!</b>
‎2007 Oct 06 11:15 AM
Hi Jabbar
As I told you in the previous post both of them have same function.For better understanding we use Changing parameter.I.e. suppose you are passing two actual parameters to the subroutine.one parameter is being changed in the form and the other one is not getting changed.Now if use only USING also it will work.But for a a person checking the code he cant make ouy which one is getting changed.SO use CHANGING.
In short
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.
Message was edited by:
Raghu Reddy
‎2007 Oct 06 11:15 AM
Hi Jabbar
As I told you in the previous post both of them have same function.For better understanding we use Changing parameter.I.e. suppose you are passing two actual parameters to the subroutine.one parameter is being changed in the form and the other one is not getting changed.Now if use only USING also it will work.But for a a person checking the code he cant make ouy which one is getting changed.SO use CHANGING.
In short
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.
Message was edited by:
Raghu Reddy
‎2007 Oct 06 11:30 AM
Raghu,
> The additions USING and CHANGING have exactly the
> same meaning. You only need to use one or the other.
This holds good only if all parameters are being passed by 'REFERENCE' (This is default), If you pass the values into the form by 'VALUE' the behavior is different.
This is why you get a syntax check warning whenever you try to pass a 'USING' value by reference to a form.
‎2007 Oct 06 11:39 AM
‎2007 Oct 06 11:20 AM
Jabbar,
For better understanding, copy paste this code into a test program and execute, check the results.
DATA: v1 type c VALUE 'A',
v2 type c VALUE 'A',
v3 type c VALUE 'A',
v4 type c VALUE 'A',
v5 type c VALUE 'A'.
perform check_params USING v1
v2
v3
CHANGING v4
v5.
WRITE : / v1, v2, v3, v4, v5.
*&---------------------------------------------------------------------*
*& Form CHECK_PARAMS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_V1 text
* -->P_V2 text
* -->P_V3 text
* <--P_V4 text
* <--P_V5 text
*----------------------------------------------------------------------*
form CHECK_PARAMS using VALUE(p_v1)
p_v2
VALUE(p_v3)
changing VALUE(p_v4)
p_v5.
p_v1 = 'B'.
p_v2 = 'C'.
p_v3 = 'D'.
p_v4 = 'E'.
p_v5 = 'F'.
WRITE : / p_v1, p_v2, p_v3, p_v4, P_v5.
WRITE : / v1, v2, v3, v4, v5.
endform. " CHECK_PARAMSHope it helps.
Regards,
Srihari
‎2007 Oct 06 11:26 AM
Hi Jabbar,
I think you got the concepts wrong for using and changing.
Just to keep it simple the parameters can be passed to forms by using or changing.
when parameterd passed bu USING it will have diferent memory for formal and actual parameters so the value of actual variable will not changed whatever operation you do in FORMS the same is not true for CHANGING. When any operation done on the parameter the actual value will change as they have the same memory.
Regards,
Atish
‎2007 Oct 06 11:38 AM