Hello Guys,
I have a requirement where i should record values based on this condition:
IE: if an account1 + account 2 is less than "0", we should record its value, else record "0"
I am using the following code:
*SELECT ( %PER_ATUA% , [DATABASE],VERSAO , ID = %VERSAO_SET%)
*XDIM_MEMBERSET PERIODO = %PER_ATUA%
*XDIM_MEMBERSET CONTA = BAS(ACCOUNT_1,ACCOUNT_2)
*WHEN CONTA
*IS *
*REC(EXPRESSION = %VALUE%, CONTA = ACCOUNT_3)
*ENDWHEN
*COMMIT
*XDIM_MEMBERSET CONTA = ACCOUNT_3
*WHEN CONTA
*IS *
*REC(EXPRESSION = (%VALUE% <0) ? %VALUE% : 0,CONTA = "ACCOUNT_4")
*ENDWHEN
Logs:
*XDIM_MEMBERSET PERIODO = 201508
*XDIM_MEMBERSET CONTA= BAS(CR_COMP_DED_IRPJ,CR_COMP_DED_CSLL)
*WHEN CONTA
*IS *
*REC(EXPRESSION=%VALUE%, CONTA = CR_COMP_DED_IRPJ_CSLL)
*ENDWHEN
*COMMIT
*XDIM_MEMBERSET CONTA= CR_COMP_DED_IRPJ_CSLL
*WHEN CONTA
*IS *
*REC(EXPRESSION=(%VALUE% <0) ? %VALUE% : 0,CONTA =DB.DEBITO_MENSAL)
*ENDWHEN
-------------------------------------------------------------------------------------------------------------------------------------
LOG:
LOG BEGIN TIME:2015-12-15 15:57:32
FILE:\ROOT\WEBFOLDERS\ZMAGGI_FISCAL \ADMINAPP\FISCAL\TEST.LGF
USER:ABAP
APPSET:ZMAGGI_FISCAL
APPLICATION:FISCAL
[INFO] GET_DIM_LIST(): I_APPL_ID="FISCAL", #dimensions=13
ATIVIDADE,CCUSTO,CONTA,CONTRAPARTIDA,DIVISAO,EMPRESA,FONTE,INDICADOR,MEASURES,MOEDA,PERIODO,PRODUTO,VERSAO
#dim_memberset=4
EMPRESA:0001,1 in total.
VERSAO:PLAN201508,1 in total.
PERIODO:201508,1 in total.
CONTA:CR_COMP_DED_CSLL,CR_COMP_DED_IRPJ,2 in total.
REC :%VALUE%
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 0.00 ms. 4 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
2 RECORDS ARE GENERATED.
CALCULATION END.
ENDWHEN ACCUMULATION: 2 RECORDS ARE GENERATED.
DATA TO WRITE BACK:
ATIVIDADE CCUSTO CONTA CONTRAPARTIDA DIVISAO EMPRESA FONTE INDICADOR MOEDA PERIODO PRODUTO VERSAO SIGNEDDATA
NAATIVIDADE NACCUSTO CR_COMP_DED_IRPJ_CSLL NACONTRAPARTIDA 0101 0001 SAPFI FIS0000001 BRL 201508 NAPRODUTO PLAN201508 89928380.64
NAATIVIDADE NACCUSTO CR_COMP_DED_IRPJ_CSLL NACONTRAPARTIDA 0101 0001 SAPFI FIS0000003 BRL 201508 NAPRODUTO PLAN201508 - 82034548.02
2 RECORDS HAVE BEEN WRITTEN BACK.
WRITING TIME :0.00 ms.
[INFO] GET_DIM_LIST(): I_APPL_ID="FISCAL", #dimensions=13
ATIVIDADE,CCUSTO,CONTA,CONTRAPARTIDA,DIVISAO,EMPRESA,FONTE,INDICADOR,MEASURES,MOEDA,PERIODO,PRODUTO,VERSAO
#dim_memberset=3
EMPRESA:0001,1 in total.
VERSAO:PLAN201508,1 in total.
CONTA:CR_COMP_DED_IRPJ_CSLL,1 in total.
REC :(%VALUE% <0) ? %VALUE% : 0
CALCULATION BEGIN:
QUERY PROCESSING DATA
QUERY TIME : 1.00 ms. 2 RECORDS QUERIED OUT.
QUERY REFERENCE DATA
CALCULATION TIME IN TOTAL :0.00 ms.
2 RECORDS ARE GENERATED.
CALCULATION END.
ENDWHEN ACCUMULATION: 2 RECORDS ARE GENERATED.
DATA TO WRITE BACK:
ATIVIDADE CCUSTO CONTA CONTRAPARTIDA DIVISAO EMPRESA FONTE INDICADOR MOEDA PERIODO PRODUTO VERSAO SIGNEDDATA
NAATIVIDADE NACCUSTO DB.DEBITO_MENSAL NACONTRAPARTIDA 0101 0001 SAPFI FIS0000001 BRL 201508 NAPRODUTO PLAN201508 0.00
NAATIVIDADE NACCUSTO DB.DEBITO_MENSAL NACONTRAPARTIDA 0101 0001 SAPFI FIS0000003 BRL 201508 NAPRODUTO PLAN201508 - 82034548.02
2 RECORDS HAVE BEEN WRITTEN BACK.
WRITING TIME :0.00 ms.
SCRIPT RUNNING TIME IN TOTAL:1.00 s.
LOG END TIME:2015-12-15 15:57:33
Note that ACCOUNT 1 and 2 are the source accounts, ACCOUNT 3 is the auxiliary account and ACCOUNT 4 is the destination account.
Unfortunately the code is not respecting the sum of the member, it´s applying the rec rule by member.
Thanks in advance for your help.