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

PERFORM - USING - CHANGING statement

Former Member
0 Likes
9,779

Hello,

I am looking at a program that has the PERFORM USING CHANGING statement and I am trying to figure out why the person is doing this. It looks like the using changing options are for calling the same process using different parameters. I have read the documentation when you press the F1 on the perform statement and I have read some of the responses in the forum but I am not grasping this. Is there more to why the person coded it this way? I have a sample of the code attached and from what I can see, this perform is called only 1 time.

TYPES: BEGIN OF ty_zfi_im_prof_inv,

bukrs TYPE zfi_im_prof_inv-bukrs, "Company Code

hkont TYPE zfi_im_prof_inv-hkont, "Account No.

END OF ty_zfi_im_prof_inv.

DATA it_zfi_im_prof_inv TYPE STANDARD TABLE OF

ty_zfi_im_prof_inv INITIAL SIZE 0.

PERFORM select_data_zfi_im_prof_inv USING p_bukrs

CHANGING it_zfi_im_prof_inv.

FORM select_data_zfi_im_prof_inv USING value(p1_bukrs) TYPE t001-bukrs

CHANGING p1_it_zfi_im_prof_inv TYPE ty_t_zfi_im_prof_inv.

  • Select data from table

SELECT bukrs "Company Code

hkont "Account No.

FROM zfi_im_prof_inv

INTO TABLE p1_it_zfi_im_prof_inv

WHERE bukrs = p1_bukrs. "Company Code

  • Issue error message if the select fails

IF sy-subrc NE 0.

IF sy-batch IS INITIAL.

MESSAGE i899 WITH text-015.

LEAVE LIST-PROCESSING.

ELSE.

MESSAGE e899 WITH text-015.

ENDIF.

ELSE.

SORT p1_it_zfi_im_prof_inv BY bukrs hkont.

ENDIF.

ENDFORM. " FORM SELECT_DATA_ZFI_IM_PROF_INV

thanks in advance for the help

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,901

i´m not sure what your problem is but i guess it´s the concept of

(using/changing).

Using is the same like "importing" at a function and means that this is a parameter you pass to the Form.

Changing is ALMOST same like "tables" at a function and means that this is a parameter you pass to the Form, it´s data might be used in the Form and probabaly is beeing changed in the Form. Afterwards the Parameter is beeing passed back to the calling program.

in other words: Using is a Call by value

and changing is a call by reference.

3 REPLIES 3
Read only

Former Member
0 Likes
5,901

Hi,

He is returning the data into p1_it_zfi_im_prof_inv using changing keyword in the subroutine. The work area is empty while entering the subroutine. after the perform is executed there would be data from zfi_im_prof_inv in this.

reward points if it helps

Regards

Read only

Former Member
0 Likes
5,901

Hi Timothy,

In General, the parameters that are passed in the USING section are passed by value, meaning, any changes to that formal parameter in side the form will not effect the sent value(Globally).

But the value that has been passed in the changing section of the perform statement will change the original value .

Using perform statement has an additional advantage of modularizing the code, other than reusability.

YOu can refer the abapdocu transaction for sample programs in:

Modularization Techniques->Procedures->Examples on subroutines.

Regards,

Ravi

Read only

Former Member
0 Likes
5,902

i´m not sure what your problem is but i guess it´s the concept of

(using/changing).

Using is the same like "importing" at a function and means that this is a parameter you pass to the Form.

Changing is ALMOST same like "tables" at a function and means that this is a parameter you pass to the Form, it´s data might be used in the Form and probabaly is beeing changed in the Form. Afterwards the Parameter is beeing passed back to the calling program.

in other words: Using is a Call by value

and changing is a call by reference.