‎2007 Apr 30 6:59 AM
Can any body tell me why do we use 'using' and 'changing'.
what is the use of them.
for Eg in the code below :
FORM help_input_file USING p_phys_file TYPE c
p_locl_file TYPE c
CHANGING p_source_path TYPE any.
‎2007 Apr 30 7:19 AM
hi,
<u>pls chk this simple example.</u>
DATA : c1 TYPE i, c2 TYPE i, res TYPE i.
c1 = 1.
c2 = 2.
data: subroutinename(3) VALUE 'SUM'.
PERFORM (subroutinename) IN PROGRAM Y_JJTEST1USING c1 c2 CHANGING res.
*WRITE:/ res.
*&----
*
*& Form sum
*&----
*
text
*----
form sum using p_c1 p_c2 changing value(p_res).
p_res = p_c1 + p_c2.
endform. " sum
This link will clear all your Doubts reagrding Perform Statement.
Have a look:
http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db977635c111d1829f0000e829fbfe/frameset.htm
rgds
reshma
‎2007 Apr 30 7:03 AM
Hi,
USING is used to pass the value to the "help_input_file " FORM . If you dont pass the P_PHYS_FILE then the value wont be available in HELP_INPUT_FILE.
CHANGING - to change the value as per the calculations and return the value to the calling program. HELP_INPUT_FILE will caculate the SOURCE PATH and pass the same to p_source_path. This value would be available/accessible to the calling method PERFORM HELP_INPUT_FILE USING P_FILE
CHANING P_PATH.
Best regards,
Prashant
‎2007 Apr 30 7:03 AM
we pass parameters to the forms through using
and changing is used if v want to have the changes in form to reflect outside the form.
‎2007 Apr 30 7:03 AM
Hi,
... USING [VALUE(p1)|p1] ... [VALUE(pn)|pn]
Effect
Defines formal parameters p1,...pn, which are replaced by actual parameters when the subroutine is called.
You can assign a type to the formal parameters p1, ..., pn (see specifying types). You can also specify the method with which they are passed.
Note
Passing methods:
USING ... p ...
The parameters are passed by reference. The field passed can be changed within the subroutine. The changes are kept beyond the subroutine.
USING ... VALUE(p) ...
The VALUE(...) addition passes the parameter by copying the field contents to a corresponding local field. VALUE parameters behave in the same way as local fields.
... CHANGING [VALUE(p1) |(p1)] ... [VALUE(pn) |(pn)]
Effect
The parameters after CHANGING can accept the same specifications as those after USING.
To link the VALUE specification with the change of a parameter value, you can use the addition CHANGING ... . Then, all the formal parameters specified by VALUE(...) are transported back to the actual parameters at the end of the subroutine (i.e. after ENDFORM). If the subroutine is terminated by a dialog message, none of the parameters referenced by CHANGING VALUE ... changes.
Otherwise, the effect of USING and CHANGING is identical.
Reward if useful.
Regards,
U. Uma
‎2007 Apr 30 7:03 AM
parameters written after USING are Inputs , and CHANGING are outputs . Just for semantic purpose , though you can change parameters which are written after USING also. ... Hope this helps.
‎2007 Apr 30 7:05 AM
Hi Ravindra,
When we are writing <b>using</b> it means we r passing tht value to the perform n by writing <b>changing</b> we mean tht we are passing tht vaue to the perform statement and changing tht value as per some manupulations.
<b>plz reward points if helpful or if it solves ur query.</b>
Thanks
Chinmay
‎2007 Apr 30 7:08 AM
We use using for those parameters which we only use inside the subroutine.
we use changing for that parameters whose value will be modified in the subroutine.
In your case,
it carries out the information that, By using the p_phys and p_locl you are going to change p_source_path.
Perhaps,
If the value of the radiobutton p_phys = 'X' , then p_source_path will have a application server path and if p_locl = 'X', then p_source_path will have a presentation server path.
‎2007 Apr 30 7:19 AM
hi,
<u>pls chk this simple example.</u>
DATA : c1 TYPE i, c2 TYPE i, res TYPE i.
c1 = 1.
c2 = 2.
data: subroutinename(3) VALUE 'SUM'.
PERFORM (subroutinename) IN PROGRAM Y_JJTEST1USING c1 c2 CHANGING res.
*WRITE:/ res.
*&----
*
*& Form sum
*&----
*
text
*----
form sum using p_c1 p_c2 changing value(p_res).
p_res = p_c1 + p_c2.
endform. " sum
This link will clear all your Doubts reagrding Perform Statement.
Have a look:
http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db977635c111d1829f0000e829fbfe/frameset.htm
rgds
reshma
‎2007 Apr 30 7:24 AM
Ravinder,
In short:
In Form modules we need pass the parameter .for this we use "using".
after processing the form it can be return some data,for that we use "changing"
Regards,
ram.