Implementing Currency Amounts Via DB Connect Data Source in SAP BW
We were facing an issue in the BW report where JPY currency amounts were displaying 100 times more than its actual value in the source.
The source of data was the SQL database via DB connect. We mapped the amounts to an info object with type CURR.
On further analysis, we found that the JPY currency has special setting for the decimals which is stored in the table TCURX. The value of field CURRDEC was set to ZERO for JPY in the TCURX table that means; JPY currencies do not have any decimals.
Hence, the decimal will be ignored while displaying it in the BW report. For example; if the value is stored as 3500.00 in BW infoprovider then it will be displayed as 350000 in the report.
In this case, the value was getting stored as it was coming from source i.e. external format. Because, the source field was not of CURR type, the data source was unable to do an automatic conversion in internal format. For example; if the value is coming as 3500 from the source then it was storing it as 3500.00 as BW always stores in 2 decimal format. Whereas, it should have converted it to the internal format and stored it as 35.00 in order to display it as 3500 in the BW report.
To resolve the above problem, we used the SAP standard function module “BAPI_CURRENCY_CONV_TO_INTERNAL”. This function module converts the currency value from external to internal format.
We wrote below code in the field routine of the respective info object.
SOURCE_FIELDS-CURRENCY = JPY.
SOURCE_FIELDS-Amount = 3500
Decimal Setting in TcurX for JPY = 0.
A) W/o Function Module:
Amount stored in the DSO = 3500.00
Amount displayed in the BEx Report = 350000 (Incorrect)
B) With Function Module:
Amount stored in the DSO = 35.00
Amount displayed in the BEx Report = 3500 (Correct)
SAP Note 1240163: Amount too high by factor of 100 for currency HUF, JPY, KRW, JOD, CLP