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

Function module

Former Member
0 Likes
507

Hi All,

Could any one explain me the purpose of using the following additions in a fm :

1.' Using and changing'

Ex : form get_data using mat1 changing mat2.

2.'Changing'

Ex. form get_data changing material.

3.'Using' .

Ex: form get_data using material.

Please explain me in detail with good examples for each of the above.

I appeciate your help.

Regards,

Vishwanath.

4 REPLIES 4
Read only

Former Member
0 Likes
468

Hi vish,

1.' Using and changing'

Ex : form get_data using mat1 changing mat2.

ANS: you are passing mat1 value to subroutine, subroutine will do some process with mat1 value and pass the changed value to mat2, so changed mat2 value will comes out from routine.

2.'Changing'

Ex. form get_data changing material.

ANS: subroutine get_data will do some process and changes the material value.

3.'Using' .

Ex: form get_data using material.

ANS: Here you are passing the material to do some process in subroutine.

Hope you got my point.

Reward points if it helps,

Satish

Read only

ferry_lianto
Active Contributor
0 Likes
468

Hi,

Within the subroutine you can modify the formal parameters irrespective of whether they are USING or CHANGING parameters. This is nothing else but messy coding.

The ABAP keyword documentation gives a good example of how to use USING and CHANGING parameters:

The following five PERFORM statements mean the same but only the fourth is recommended, since it is the only one that documents the interface of the subroutine called.


DATA: a1 TYPE string, 
      a2 TYPE string, 
      a3 TYPE string, 
      a4 TYPE string. 
 
PERFORM test USING a1 a2 a3 a4. 
PERFORM test CHANGING a1 a2 a3 a4. 
PERFORM test USING a1 CHANGING a2 a3 a4. 
PERFORM test USING a1 a2 CHANGING a3 a4. 
PERFORM test USING a1 a2 a3 CHANGING a4. 
 
... 
 
FORM test USING p1 TYPE string 
                p2 TYPE string 
          CHANGING value(p3) TYPE string 
                   value(p4) TYPE string. 
  ... 
ENDFORM. 

Regards,

Ferry Lianto

Read only

0 Likes
468

Hi Ferry,

Could you explain with simple and complete example so that I can copy and debug the same.

Regards,

Vishu.

Read only

Former Member
0 Likes
468

Hi

Check this Demo program in your System .

Hope this helps .

DEMO_MOD_TECH_FB_STRING_SPLIT .

Thanks

Praveen