Move money from cost center to cost center

Question: Hi Guys,
I need to create a function to move money from one cost center to another cost center. the data modol is key figure modol, so we have two key figure columns define by Zfromkeyand Ztokey. The requirments is that the user will assign vaule to the cost_center1(from) and cost_center2(to) and the amount he want to transfer in Zfromkey , the function should copy the amount to Ztokey and change the cost_center1(from) to cost_center2(to).

Field to be changes include key firue and cost center.
The formula I use is like this:

data cost_center1 like 0COSTCENTER.
data cost_center2 like 0COSTCENTER.
cost_center1 = varv ('fromcostcenter'}.
cost_center2 = varv ('tocostcenter'}.

{Ztokey,cost_center2} = {zfromkey,cost center1} * -1.

I type 500.00 and run the function, it's not work. when I get into debug mode, I notice that the value passing from {zfromkey,cost center1} is 0 instead of 500.00.
I have use this kind of formula to do the copy before, but that based on account modol, I think the key figure modol can not use this kind of formula to do the copy.
what else you guys think I can do to make this money tranfer happen?

Thanks in advance.

Answer:
Couple of more questions for BPS.

1, Can variable be passed to user exit?I did not see there is any place we can do that.
2. Can we apply those standard function such as copy to only specific key figure inseard of all the key figure in the layout?

Answer:
Just find out that the standard function can apply to some of the key figure using conditions.
Copyright ?2007 - 2008 www.jt77.com