Application Development 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: 

Doubt on Sub routines

Former Member
0 Kudos

Hi friends,

I am using perform statement like

perfrom get_data using gi_data changing gi_output.

in the form of get_data i need to change gi_data but while coming out of form i need the gi_data to have the same value as i had before.

Is using is not like Call By value??

but now even if i pass through using the value is getting changed when it come out of form..

is there any ways to implement this please help me ......

4 REPLIES 4

Former Member
0 Kudos

Hi Gokul,

You can use the PERFORM as it is.

In the FORM, you can declare a LOCAL Internal table of type GI_DATA and assign the values of GI_DATA that you get in USING parameter to the local Intertnal table.

FORM GET_DATA USING GI_DATA

CHANGING GI_OUTPUT.

data: l_i_data type gi_data.

l_i_data[] = gi_data[].

Do what ever changes you want to do with l_i_data which is replica of gi_data, with out changing the original internal table.

ENDFORM.

<b>Reward points for informative answers.</b>

Best Regards,

Ram.

Former Member
0 Kudos

Hi Gokul,

when u r using call by vaule changes are not reflected in other cases call by reference for changing only changed values in sub routine will reflect can u post u r code for checking

reward points to all helpful answers

kiran.M

varma_narayana
Active Contributor
0 Kudos

Hi

If you pass the Parameter as

USING <P>

or

CHANGING <P>

both are Call by Reference ..

For Pass by Value

USING VALUE(P)

So change ur code like BELOW.

<b>Perfrom get_data using VALUE(gi_data) changing gi_output.</b>

Reward if Helpful.

Former Member
0 Kudos

Hi,

It seems that u are only using the value in gi_data but do not want any changes in it once you come out of the subroutine.If this is the case,then you can do one thing.You can declare a local work area inside the subroutine of type gi_data.Pass all the data from gi_data to the local int table and then do whatever calculations/modifications you need to do.If you do this then you will not be modifying the data in gi_data and at the same time achieve what you want to.

Hope it was useful.

Thanks,

Sandeep.