21 Sept 2008

Handling Amount Values with currencies in BW

SAP stores amount values of different currencies with a fixed interpretation of having two decimal places.There are some currencies that do not work well with such two decimal place setting. Usually this is because for some currencies, a fraction of currency unit is meaningless. That is true for the Japanese Yen, the
Turkish Lira, and Korean Won and many other such currencies.

TCURX table
The table determines the number of decimal places in the output according to the currency key. If the contents of currency exist in table TCURX as currency key CURRKEY, the system sets the number of decimal places according to the entry CURRDEC in TCURX. Otherwise, it uses the default setting of two decimal places. That means that TCURX only has to list the exceptions with a number of decimal places
other than 2.

Lets observe the following steps where TCURX is refered.
• Step 1: Updating the amount values into BW data target
• Step 2: Displaying the amount values in the BW reports.

Step 1: Updating the amount values into BW data target
When we load the data into BW having amount fields in it, it checks the TCURX table for the currency entry.If the currency entry is present in TCURX table, it divides the amount value by 10** (2- (CURRDEC entry in TCURX table)).
Step 2: Displaying the amount values in the BW reports.
The exactly converse happens while displaying such values in the report output. The amount value will be multiplied by 10** (2- (CURRDEC entry in TCURX table)) while displaying in the report output.

Example
Note: The KRW (Korean WON) currency key is present in the TCURX table with the decimal place value as 0.
Step 1:
Whenever the amount 123 KRW is loaded in BW, it checks the TCURX table for the KRW currency.After finding the entry in TCURX table, it stores the amount value in target as 123 / {10** (2 – (0))} that is 1.23 KRW. (The amount is divided by 100)
For this to happen, we have to make a specific setting in the InfoPackage thru which we schedule the loads.The checkbox for “Currency Conversion for External Systs” should be ticked as shown below.
Step 2:
While displaying the same amount value in the report output, the exactly opposite will happen. That is the amount value 1.23 KRW will be multiplied by 100 and shown as 123 KRW (Amount is multiplied by 100) in the report output which is the initial value which came from the source system.

General Observations
In most of the cases, we miss step 1 as it need manual intervention (like ticking the checkbox for “Currency Conversion for External Systs”) whereas the step 2 is carried out by default and we get the wrong results in the report output. Even if amount is not divided while loading, the multiplication is carried out by default at the time of reporting. That is the reason why it is necessary to check whether the step 1 is being carried out successfully or not.
As the settings in the External Data tab of InfoPackage applies to the data which is coming from the external source only, the checkbox for “Currency Conversion for External Systs” works for the currencies which are coming from the source system directly. Hence if you write logic to pick up the currency (lookup etc.) in either
transfer rules or update rules, step 1 will not be carried out. Step 2 will be carried out by default thereby giving wrong results in the report output.

Note : This knowledge was got after i read :
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/600aa67b-c348-2b10-f690-aaa81d12ec6a

No comments: