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
Hi Ana,
You are doing something strange to my mind: in the functions you are referencing CURRENTMEMBER and trying to pass the result to BADI... What is the idea?
B.R. Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI, Vadim,
I want to change the parameter according to the dimension properties. For example, if the seller is internal, the payment of the commission of it falls on the fifth day, but if the seller is external, the commission should be paid on the 10th or 18th of the same month.
As I said before, I don't know how to use *FUNCTION and I need same examples or any documentation... Maybe it's not possible to make a logic like this and I have to create another ...
Could you help me?
Regards,
Ana Teresa
Hi Ana,
*FUNCTION is useless for this purpose.
You have a badi in your script logic and you have to supply some parameters for this badi.
Let's assume that your script is launched by DM (is it correct?) and user will select ONLY one member of SALESAGREEMENT dimension. Then you can use *SELRCT to put the property value in some %% variable and provide this variable as a badi parameter:
*SELECT(%SETYPE%,"[SELLERTYPE]",SALESAGREEMENT,"[ID]='SALESAGREEMENT_SET'")
and use %SETYPE% as a badi parameter that will be replaced by the property valye SELLERTYPE.
But it's better (as Gersh recommended) to read this property inside BADI code!
B.R. Vadim
Updating...
When I use a function = <number> the badi works well.
*FUNCTION DIA_PGTO = 07
*FUNCTION MES_PGTO = 1
*FUNCTION MES_FIXO = NULO
*START_BADI SLS_BADI_BUSCA_DIA_UTIL
PARAM_TIPO_DATA = UTIL
PARAM_DIA=DIA_PGTO
PARAM_ADIC_DIA=0
PARAM_MES=MES_PGTO
PARAM_DIRECAO=1
PARAM_METRICA=PGTOCOMISSAOVENDA
PARAM_MES_FIXO=MES_FIXO
QUERY=ON
//WRITE=ON
*END_BADI
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Unfortunately, I need more information how to use *FUNCTION and *ENDFUNCTION.
Anybody could help me? Is there any doc?
Best regards,
Ana Teresa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| 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.