HI, Experts,
I don't know exactly how to use *FUNCTION at script logic. is there any documentation? May anybody pass the link?
Now, we are using SAP BPC 10.o NW.
We have a script logic with a BADI and we would like to pass parameters that change by a function.
The logic is something like that below. May anybody helps me? Can I use *FUNCTION inside the logic script or I need to move to mdxlib?
*FUNCTION DIA_PGTO()
IIF((([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("SELLERTYPE"))="INTERNO"),"05",IIF(RIGHT(([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("RECEIPTMONTHADJ")),2)<="07","10",IIF(RIGHT(([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("RECEIPTMONTHADJ")),2)<="15","18","10")))
*ENDFUNCTION
*FUNCTION MES_PGTO()
IIF((([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("SELLERTYPE"))="INTERNO"),1,IIF(RIGHT(([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("RECEIPTMONTHADJ")),2)>"15",2,1)))
*ENDFUNCTION
*FUNCTION MES_FIXO()
IIF((([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("SELLERTYPE"))="INTERNO"),"NULO",([SALESAGREEMENT].CURRENTMEMBER.PROPERTIES("RECEIPTMONTHADJ")))
*ENDFUNCTION
%AUX_DIA_PGTO% = DIA_PGTO()
//*START_BADI SLS_BADI_BUSCA_DIA_UTIL
//PARAM_TIPO_DATA = UTIL
//PARAM_DIA=%AUX_DIA_PGTO% // DIA 07 POR EXEMPLO (2 CASAS DECIMAIS
//PARAM_ADIC_DIA=0 // NÃO ADICIONA NENHUM DIA
//PARAM_MES=MES_PGTO() // MES SEGUINTE
//PARAM_DIRECAO=1 // 1 PARA FRENTE E 0 PARA TRÁS
//PARAM_METRICA=PGTOCOMISSAOVENDA // NOME DA MÉTRICA DESTINO
//PARAM_MES_FIXO=MES_FIXO() // UTILIZAR O MÊS DE CADA REGISTRO COMO BASE DE CÁLCULO
//QUERY=ON
//WRITE=ON
//*END_BADI
Request clarification before answering.
Hi Ana Teresa,
In the way you wrote it I'd think that BADI will receive these parameters as texts. I.e. what you have between *FUNCTION and *ENDFUNCTION will be passed as parameter value, not the value calculated but that IIF expression.
In such case you'll have to interpret them inside your BADI.
Regards,
Gersh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Gersh,
I will insert the logic at BADI. Thanks.
But, could you explain how can I use *function and *endfunction?
a) Is it possible to use mdx statement inside? Do you have some example?
b) this *function statement must to be at script logic or mdblib
c) how can we call a function? Do you have some example?
Best Regards,
Ana Teresa
Hello Ana Teresa,
Documentation at
http://help.sap.com/saphelp_bpc10_nw/helpdata/en/4c/2c494697df1ca9e10000000a42189e/frameset.htm
has the following example of a function:
*FUNCTION Price(%COST%,%HOUR%)
%COST%/%HOUR%
*ENDFUNCTION
[#CE0661000] = Price([CE0004000],[CE0652000])
So, you can see MDX statement inside. Basically inside FUNCTION you can have any text as long as it's correct after FUNCTION is substituted by its body.
Don't think of it as a Function call in most programming languages, like in ABAP. Think of it as a string substitution.
-Gersh
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.