on 06-26-2007 10:56 AM
Hello experts.
I'm trying to do a formula fox to calculate a cost center that its equal to responsible cost center, but it gives an error. Could anyone help me?
Here's my code:
DATA TXAMT_AI TYPE F.
DATA TXAMT_AFT TYPE F.
DATA CCUSTO TYPE 0COSTCENTER .
DATA CCRESP TYPE 0RESP_CCTR.
atribuição de valores às variáveis
TXAMT_AI = VARV('NCOAM01').
TXAMT_AFT = VARV('NCOAM02').
CCRESP = OBJV().
CCUSTO = CCRESP.
ACTIVOS INTANGÍVEIS ********************
amt de AI - despesas instalação
{#,CCUSTO,6631000000,#} = ( { #,#,4310000000,CCRESP} * TXAMT_AI) / 100.
There's an registry with responsible cost center and I want to calculate the cost center...
Thanks in advance.
Vitor Ramalho
Hi Vitor,
OBJV() indeed can only be used if the characteristic is not be changed. What you can do is the following:
DATA TXAMT_AI TYPE F.
DATA TXAMT_AFT TYPE F.
DATA CCUSTO TYPE 0COSTCENTER .
DATA CCRESP TYPE 0RESP_CCTR.
DATA LV_STRING TYPE STRING.
atribuição de valores às variáveis
TXAMT_AI = VARV('NCOAM01').
TXAMT_AFT = VARV('NCOAM02').
FOREACH CCRESP.
LV_STRING = CCRESP.
CCUSTO = LV_STRING.
ACTIVOS INTANGÍVEIS ********************
amt de AI - despesas instalação
{#,CCUSTO,6631000000,#} = ( { #,#,4310000000,CCRESP} * TXAMT_AI) / 100.
ENDFOR.
With the foreach loop you will loop over all existing combinations of CCRESP (for which plan data exists) in your plandata.
Let me know this works.
regards
D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
did you get an error or the function did not provide the correct result. For the latter, please debug your function by adding:
1) break-point. in your FOX
2) defining a planning sequence and creating a selection variant
3) run SE38 and program rspls_plseq_execute. -> hit execute and then choose the planning sequence with the variant created in 2). Check what goes wrong.
regards
D
"Isn't the responsible cost center an attribute of cost center"
You can try this if you dont use the same object to store data of cost centre and responsible cost centre.
Ravi Thothadri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
what is your error?
please note that
TXAMT_AI and TXAMT_AFT should be of the same type as NCOAM01. Otherwise you get error that the local variable has a wrong data type.
TXAMT_AI = VARV('NCOAM01').
TXAMT_AFT = VARV('NCOAM02').
grtz
D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
for time related characteristics there are work-arounds with TMVL. However in your case, I'm not aware of a work around via FOX two totally independent characteristic. An exit function can always provide a solution of course.
One remark: Isn't the responsible cost center an attribute of cost center. If so, you can try ATRV of ARTVT functions.
regards
D
Hi Vitor,
Are you sure the error you have is in the statement CCUSTO = CCRESP.? Do you get an error while running the function or while checking the syntax? Can you specify the exact error message?
The two infoobjects on which you have created these variables (0COSTCENTER, 0RESP_CCTR) have the same data type so I am not really sure why this should not work. I have used it in Integrated Planning and this kind of statement works.
You can try creating a variable of type STRING and do the below:
STR = CCRESP.
CCUSTO = STR.
Hi Mayank.
I get the error when i'm checking the syntax, and your'e right, the error occours because of the statement CCRESP = OBJV().
The error is "Formula error: Type 0RESP_CCTR is not allowed for the function".
I'm working with BPS.
Could you help get a solution?
Thanks in advance.
Vitor Ramalho
Message was edited by:
Vitor Ramalho
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.