Loading JPY Currency Amount in SAP BW
We were facing an issue in BW report where JPY currency amounts were displaying 100 times more than its actual value in the source.
The source of data was SQL database via DB connect. We mapped the amounts to an infoobject 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 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 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 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 infoobject.
DATA: lv_Amount_Ext TYPE BAPICURR-BAPICURR. lv_Amount_Ext = SOURCE_FIELDS-Amount. CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_INTERNAL' EXPORTING currency = SOURCE_FIELDS-CURRENCY amount_external = lv_Amount_Ext max_number_of_digits = 23 IMPORTING AMOUNT_INTERNAL = RESULT.
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