on 09-22-2017 2:28 PM
We have a requirement, where we have to call business rules through logic script based on some condition. For example, if ACCOUNT VALUE > 0 then *INCLUDE ABC.LGF, else PQR.LGF.
Can we achieve this? Happy to elaborate further if required.
Sorry, but looks like you are not reading my answer!
"*REC(C_ACCOUNT=INT_04,EXPRESSION=(([C_ACCOUNT].[TECH_INT_TOTAL],[C_ACCOUNT_ORIG].[DEFAULT])>0)?EXPRESSION=([C_ACCOUNT].[TECH_INT_04]+[C_ACCOUNT].[TECH_INT_16]):0)" - incorrect syntax!
Syntax from my post:
*REC(EXPRESSION=%VALUE%>0 ? %VALUE% : 0, ACCOUNT=A2)
Your REC has to be:
*REC(EXPRESSION=([C_ACCOUNT].[TECH_INT_TOTAL],[C_ACCOUNT_ORIG].[DEFAULT])>0 ? [C_ACCOUNT].[TECH_INT_04]+[C_ACCOUNT].[TECH_INT_16] : 0, C_ACCOUNT=INT_04)
For the rest you have to explain the scoping logic...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Vadim for reply.
We tried the suggested code, but even if TECH_INT_TOTAL is > 0, system is not considering [C_ACCOUNT].[TECH_INT_04]+[C_ACCOUNT].[TECH_INT_16], rather putting value as 0 for INT_04. That means, it is always considering the code after ":" i.e. "0". Is it?
Also, since we are already putting C_ACCOUNT=INT_04 in our expression, what should we put in
*When C_ACCOUNT
*IS ?????
Thanks.
Sorry, but you are not providing full info about your case - I am unable to help you!
Please read: https://blogs.sap.com/2014/01/31/how-to-ask-questions-about-script-logic-issues/
And provide required info and sample test case!
"system is not considering ..." scope may be incorrect!
"what should we put in
*When C_ACCOUNT
*IS ?????" - explain the data you have!
Hi Sameer,
I'm not sure which SP you are in but you can explore the keyword
*XDIM_SKIPNULLCHECK-
As Vadim suggested, script is not designed to put conditional statement on transaction data and the conditional statement is very native. You have to play around with 'When" condition or skipnull to achieve your desired results.
Expand further on the requirement and there can be a way around.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but *XDIM_SKIPNULLCHECK has ABSOLUTELY no relation to conditions on transaction data values. It's related to master data checks and in most cases can be replaced by SELECT/FOR/NEXT.
"You have to play around with 'When" condition or skipnull to achieve your desired results." - incorrect!
No, we can't!
Script logic is not a real language and there is no IF THEN in it.
Even more you can't change the script execution based on transactional data value.
The only supported thing is ternary operator in WHEN/ENDWHEN loop:
*WHEN ACCOUNT
*IS A1
*REC(EXPRESSION=%VALUE%>0 ? %VALUE% : 0, ACCOUNT=A2)
*ENDWHEN
If you are able to use WHEN/REC/ENDWHEN instead of your rules you can do something!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
3 | |
1 | |
1 | |
1 | |
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.