Monday, January 30, 2017

What foreign currency rate was used in BW currency conversion?

BW uses standard SAP’s ECC functionality with regards to foreign (FX) currency conversion. This means that same set of TCUR* tables are being used while the BW system is doing the conversion. This is valid while doing the FX conversion during transformation /loading of data and also while running reports.


In BW reporting a key figure in report can have Conversion Type specifies in its definition under Conversion tab in its properties. 



The Conversion Type that can be chosen here are defined in the SAP BW backend – in tcode RSCUR. Here all settings like: what and how an Exchange Rate shall be obtained; where a source and target currency shall came from; and Time Reference to which the conversion type shall be tied to are specified.

So this is all that can be setup for the FX conversion. While looking at the converted numbers in the report’s output an issue of wrong data can arise from users. Question here is basically what FX from table TCURR was used?

To find out that for starter an “Currency and Unit Conversion” debugging can be started form t-code RSRT. This is available by hitting on “Execute + Debug” button.


While debugging it can be seen that following function modules are used in following sequence:
RSW_CUR_TRANSLATION_RATE_GET   Wrapper function ->
-> RSW_CTT_GET                                  Reads currency translation type
-> RSW_SCUR_CHECK_AND_GET              Determine source currency
-> RSW_TCUR_CHECK_AND_GET              Determine target currency
-> RSW_TRANSLATION_DATE_GET  determines date used to find translation rate
-> RSW_RATE_GET_BASIC                              determine the translation rate
-> CONVERT_TO_FOREIGN_CURRENCY here function DATA_FROM_DATABASE is called which calls another function DATEN_BEREITSTELLEN and this one finally reads the FS rate from table TCURR for previously determined Currency conversion type; from/to currency, date and client of the SAP BW system.

























Therefore you may want to just set a breakpoint into the FM CONVERT_TO_FOREIGN_CURRENCY to speed up debugging process.
Notice that variable DATC is nothing else just value from EXC_DATE variable converted into internal format by below ABAP statement:

CONVERT DATE exc_date INTO INVERTED-DATE datc.

This means the source variable in character format is converted into target one as complement on nine - difference to the number nine.
Needless to say that above statement is obsolete ABAP statement. It shall be replaced by using TRANSLATE statement.

More information:

No comments: