on ‎2016 Sep 12 9:27 AM
Hi,
I have a requirement to use the ternary operator A>B ? C : D in a *REC statement. The new part is, that I want D to not be written. In other words, if A>B I want BPC to write C but in all other cases I want BPC to not write anything. Is that possible?
Thanks,
Arnold
Request clarification before answering.
Writing nothing is equivalent to writing destination over destination. This is the only way to write nothing.
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 am working with Arnold on this script.
The reason for our request is as follows:
we are planning on one Member of Dimension call Project, let us call this member P_1000.
This Member can be planned per Plant, lets assume we plan on Plant PL_ABC.
As one moment of time, the project is approved and also existing in SAP ERP with a different - automatically by SAP - allocated number, let call it P_9000.
Our requirement is now to transfer all Data from P_1000 to P_9000.
Therefore we wrote a Logic which is doing it, by reading PROJECT.[Property.PL_ABC] (which is P_9000).
But once we did the transfer, it should not be done again as the pforecasting continues on P_9000.
Therefore we posting a flag per "dumm"-project/ plant combination, and reding it with a ternary operator.
The part we are failing on is the statement where the transfer from P_1000 to P_9000 is done.
*IS MY_NEXT
*REC(EXPRESSION = (LOOKUP(AD13)<1) ? -%VALUE%: LOOKUP(AD12),AUDITID = AD_12)
*REC(EXPRESSION = (LOOKUP(AD13)<1) ? %VALUE%:NULL,PROJECT = PROJECT.MY_NEXT,AUDITID = AD_11)
*REC(EXPRESSION = (LOOKUP(AD13D)<1) ? 1:(LOOKUP(AD13D))/(LOOKUP(AD13D)),AUDITID = AD_13,TIME = 0000.TOTAL,ACCOUNT=OECC10999,PRO_TYPE = PT_NON)
*ENDWHEN
*ENDWHEN
*NEXT
The aim is to remain the existing records as they are in the destination once they have been written.
Do you have any idea if there are other possibilites?
I though about a Lookup for the AD_11 posting, but did not find a solution for it yet.
Thanks
Johannes
HI Vadim,
thanks for your reply.
Although I found a solution, I would like to share that in a correct way.
We are on BPC 10.0 (SP 20) on BW 730 (SP 14).
We have following dimension in the model
ACCOUNT (A), AUDITID (D), CATEGORY (C), INITIATIVE (U-3), PLANT (E), PRODUCT (U-1), PROJECT (U-2), PRO_STATUS (S), PRO_TYPE (U-4), RPTCURRENCY (R), TIME (T)
What we try to achive is described in the previous post, we try to run it as a package.
No Selections are applied for the Datamanager Package, Selection is done by Masterdata and reading the flag.
The problem was that in case that the flag is set, the original value should be kept,
but there is no possibility to do nothing if the flag is set, thus the value have been overwritten by a "0".
Due to a complex setup (PLANT ID's are Properties in Project, some are filled, some are empty) it seems not to be possbile to have a correct lookup.
My solution was as follows:
*FOR MY_NEXT = %MY_PLANTS%
*WHEN PROJECT.MY_NEXT
*REC(EXPRESSION = (LOOKUP(AD13)<1) ? -%VALUE%: LOOKUP(AD12),AUDITID = AD_12)
*REC(EXPRESSION = (LOOKUP(AD13)<1) ? %VALUE%:0,PROJECT = PROJECT.MY_NEXT,AUDITID = AD_11)
*REC(EXPRESSION = (LOOKUP(AD13D)<1) ? 1:(LOOKUP(AD13D))/(LOOKUP(AD13D)),AUDITID = AD_13,TIME = 0000.TOTAL,ACCOUNT=OECC10999,PRO_TYPE = PT_NON)
*ENDWHEN
*ENDWHEN
*NEXT
*WHEN PROJECT
*IS <SELECT for my Destination Projects>
*REC(FACTOR=1)
*ENDWHEN
So as a result:
If the flag is empty, there is no data on the Project, so the second Rec-Statement is writing the Values (correctly) on the destination project. The last Rec Statement is adding "0" to the project.
The flag is set after first run, thus the second Rec Statement is setting the project to "0", but the last rec Statement is writing the current value to the project.
I tested it several times and think the logic is doing what it should.
Thanks!
Johannes
Sorry, but I am unable to understand what flag you are talking about?
"The problem was that in case that the flag is set, the original value should be kept,
but there is no possibility to do nothing if the flag is set, thus the value have been overwritten by a "0"." - absolutely unclear!
You will see that FULL script text is required in the discussion!
Also - incorrect statement:
*FOR MY_NEXT = %MY_PLANTS%???
Please spend some time to provide a clear picture!
Hi Arnold,
Have you referred this Ternary Operator syntax error in BPC NW Script ... | SCN
We can write 0 instead of D!
Regards,
JP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 30 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.