Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using n Changing

Former Member
0 Likes
859

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
831

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

8 REPLIES 8
Read only

Former Member
0 Likes
831

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

Read only

Former Member
0 Likes
831

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.

Read only

Former Member
0 Likes
831

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

Read only

Former Member
0 Likes
831

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.

Read only

Former Member
0 Likes
831

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

Read only

Former Member
0 Likes
831

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.

Read only

Former Member
0 Likes
832

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

Read only

former_member189631
Active Contributor
0 Likes
831

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.