Browse All Articles
> SAP BI BO Unit or Currency Logic for unknown units
In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereby the developer won’t be able to display the unit of that particular key figure in any BO report.
Some key figures won’t make any sense unless there is a unit associated with it. For ratios and number of days, no unit is expected. But if the calculation is of a Revenue then Revenue getting displayed as 500 instead of 500 USD (or any other valid currency) will not be meaningful. Also it would be OK to display 500 *
(calculated revenue is in multiple currencies); i.e, if
and if A and B are in different currencies, then resultant currency should be shown as *. But not displaying any unit/currency at all would be an issue.
In the above mentioned scenario, if Revenue is created as a local formula in a BEx query, then there is a possibility that the unit and formatted value objects of Revenue not getting generated in BO Universe. In this case, we can still arrive at the unit or currency of Revenue by identifying the individual key figures which are part of the Revenue formula. That is, if we have the unit objects of A, B, C key figures available in the universe, then we can arrive at the unit or currency of Revenue.
The table below shows the possible scenarios for currencies of any two key figures and based on their currency values what should be the final currency:
indicates multiple currencies; Null
indicates no value; Not Null
indicates some valid currency)
Scenario Currency 1 Currency 2 If C1=C2 Expected Output
======== ========== ========== ======== ===============
1 * Null False *
2 Null * False *
3 * Not Null False *
4 Not Null * False *
5 * * True *
6 Null Null True Null
7 Not Null Not Null True Currency 1
8 Not Null Not Null False *
9 Not Null Null False Currency 1
10 Null Not Null False Currency 2
The following code has been implemented in a Web Intelligence report and covers all the possible above mentioned scenarios. Here is the formula to be used to evaluate the result of currency combination between two known currencies:
=If(Currency 1="*" Or Currency 2="*" Or (Not (IsNull(Currency 1)) And Not (IsNull(Currency 2)) And (Currency 1<>Currency 2));"*";If((Currency 1=Currency 2) Or IsNull(Currency 2);Currency 1;Currency 2)).
Considering the above example of Revenue=A+B+C, the above logic has to be used twice, once between A and B and a second time between C and previous result of A and B to arrive at the unit/currency of Revenue .