on 06-03-2010 7:59 PM
Hi,
I am trying to copy some key figure values from one realtime cube to other. I have put infoprovider and type as fields to be changed
Below is the code.
DATA IN TYPE 0INFOPROV.
DATA T TYPE 0TYPE.
FOREACH IN, T.
{0AMOUNT, ZCC_C01, #} = {ZMIR, ZCC_C02, 002}.
{0AMOUNT, ZCC_C01, #} = {ZCUSL, ZCC_C02, 002}.
ENDFOR.
The code works well partly. It always copies the statement which is put second always. In the above case it only copies ZCUSL value. But if I interchange the lines as below it would copy only ZMIR value.
FOREACH IN, T.
{0AMOUNT, ZCC_C01, #} = {ZCUSL, ZCC_C02, 002}.
{0AMOUNT, ZCC_C01, #} = {ZMIR, ZCC_C02, 002}.
ENDFOR.
Though I am copying the keyfigures to 0AMOUNT, the records are differenciated in ZCC_C01 cube by cost element because the cost element would be different for each keyfigure value.
Any help would be highly appreciated.
Thanks,
Kumar
As you said Cost element is different for each key figure value, you need to keep cost element also in the fields to be changed. And there is no need of FOREACH IN and T here because you are already using hard code values here for fetching data. The code you have written will always overwrite the first record copied with the second record because cost element is not taken into consideration which is the differentiating field for both key figures. What is the logic for cost element for these two key figures? Say for example, you need to copy ZMIR to 0Amount with cost elements and ZCUSL to 0Amount without cost element. Then the code is like this. This is just an example. Relate this to your requirement and form the code accordingly.
DATA CE1 TYPE 0COSTELEMENT.
FOREACH CE1.
{0AMOUNT, ZCC_C01, #, CE1} = {ZMIR, ZCC_C02, 002, CE1}.
{0AMOUNT, ZCC_C01, #, #} = {ZCUSL, ZCC_C02, 002, #}.
ENDFOR.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks!! Bindu.
I agree IN and T dont have to be in the FOREACH.
In ZCC_C02 cube that is the source cube I would have say 6000010 Cost element for ZMIR and 6000020 cost element for ZCUSL.
So the data would be like
CE--
6000010-10000---0-
6000020-----0-----20000-
I would want the result in the target cube as
CE----
0AMOUNT
6000010---10000-
6000020---20000-
Here is the changed code.
DATA CE1 TYPE 0COSTELEMENT.
FOREACH CE1.
{0AMOUNT, ZCC_C01, #, CE1} = {ZMIR, ZCC_C02, 002, CE1}.
{0AMOUNT, ZCC_C01, #, CE1} = {ZCUSL, ZCC_C02, 002, CE1}.
ENDFOR.
Even after changing the code I get the same result. Only one Keyfigure generates records. The Keyfigure In the second statement generates the record. The First one doesnt. Any help?
Thanks!!
Kumar
Thanks Andrey!!
I didnt understand this below statement.
IF {ZMIR, ZCC_C02, 002} 0.
I have assumed that ZMIR not eaualt to Zero. Here is the code I have changed it to.
IF {ZMIR, ZCC_C02, 002} NE 0.
{0AMOUNT, ZCC_C01, #} = {ZMIR, ZCC_C02, 002}.
ENDIF
IF {ZCUSL, ZCC_C02, 002} NE 0.
{0AMOUNT, ZCC_C01, #} = {ZCUSL, ZCC_C02, 002}.
ENDIF.
Here replace NE by Not equal operation in Fox. I think Not equal sign doesnt show up here. It comes as blank.
But this doesnt work either..NO records get generated. Earlier I was getting few records. Any ideas?
Thanks
Kumar
Edited by: Kumar01 on Jun 7, 2010 5:14 PM
Edited by: Kumar01 on Jun 7, 2010 5:15 PM
Edited by: Kumar01 on Jun 7, 2010 5:15 PM
Hi.
I don't know why, but code markup does not show NOT EQUAL.
The statement is:
IF {ZMIR, ZCC_C02, 002}<>0.
If the function doesn't generate records you can check your filter.
Execute sequence in IP modeler with trace and see which reference data you get.
You can also try kind of FOX "debug" with MESSAGE statement:
IF {ZMIR, ZCC_C02, 002}<>0.
MESSAGE I001 (YOUR_MESSAGE_CLASS) WITH 'ZMIR <> 0'.
{0AMOUNT, ZCC_C01, #} = {ZMIR, ZCC_C02, 002}.
ENDIF
IF {ZCUSL, ZCC_C02, 002} 0.
MESSAGE I001 (YOUR_MESSAGE_CLASS) WITH 'ZCUSL <> 0'.
{0AMOUNT, ZCC_C01, #} = {ZCUSL, ZCC_C02, 002}.
ENDIF.
Run in IP modeler and see whether you get any messages from FOX.
Regards.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.