You are on page 1of 4

SAP Note

 

  886532 - Pricing: Displaying and rounding numbers Version   5     Validity: 25.01.2011 - active   Language   English

 

Header Data
Released On Release Status Component Priority Category 25.01.2011 12:09:13 Released for Customer SD-BF-PR Pricing Recommendations / Additional Info Consulting

Other Components SD-MD-CM Conditions and Condition Maintainance

Symptom
This consulting note describes a) why certain data fields are displayed differently on screen than they are in the database and b) which effects the use of fixed point arithmetic has on arithmetic operations. Symptom 1: If you enter a condition rate for a percentage condition, you can specify a maximum of three decimal places for the condition rate.  After you enter a condition rate, it is also displayed on screen as expected and also used correctly in the pricing results.  However, the condition rate in the database table in question (or when the field is displayed in debugging mode) seems to be incorrect. Example: You enter a condition rate of '4.2' (for example, for a master data record or a document condition).  To confirm this entry, you choose ENTER.  '4.200 %' appears on screen.  If, for example, this condition record is selected in the KONP (or KONV) table, '42.00', and not '4.200', is displayed in the KBETR field. Explanation of this behavior: See the section entitled 'Reason and Prerequisites' 1./2a./3a. Symptom 2: You enter a condition rate for a currency that does not have two decimal places (for example, Japanese Yen JPY has 0 decimal places).  After you enter a condition rate, it is also displayed on screen as expected and also used correctly in the pricing results.  However, the condition rate in the database table in question (or when the field is displayed in debugging mode) seems to be incorrect. Example: You enter a condition rate of '75' (for example, for a master data record or a document condition).  To confirm this entry, you choose ENTER.  '75 JPY' appears on screen.  If, for example, this condition record is selected in the KONP (or KONV) table, '00.75', and not '75', is displayed in the KBETR field. Explanation of this behavior: See the section entitled 'Reason and Prerequisites' 1./2a./3b. Symptom 3: In a user-defined report, a WRITE statement is used to display a condition rate on screen.  The condition rate that is displayed is incorrect. Example: The user expects the system to display a condition rate of '123 JPY', instead it displays '1.23 JPY'. Explanation of this behavior: See the section entitled 'Reason and Prerequisites' 1./2a./3b./4. Symptom 4: In pricing, the system seems to calculate incorrect values. Example: Sales quantity      3,763 M2 Condition rate8,42 EUR / 1 KG Quantity relation    1000 M2 = 4567 KG The user expects a condition value of   3,763 / 1000 * 4567 * 8,42 = 144,7029...                             = 144,70 EUR (rounded) The system takes account of the decimal places in the quantity fields and value fields and actually calculates the following condition value in t w o steps:   Condition basis: 3,763 / 1000 * 4567 = 17,18562...                                       = 17,186 KG (rounded)   Condition value:  17,186 * 8,42 = 144,7061...

a multiplication) is executed and the outcome of the operation is used for an assignment. DEC or QUAN) are considered as integers the case of assignments. dictionary types CURR. b) Alternatively.         WRITE : kbetr CURRENCY waers. /. a WRITE statement is used to display a value field and a reference currency is not specified in this case. The system requires a reference field in order to correctly display a value field on screen. Power of ten.     DATA: waers LIKE konv-waers. KONP.          DATA: kbetr LIKE konv-kbetr VALUE '1.  waers.  In this case.123  % 5.23'. value fields should therefore always be displayed with the CURRENCY addition. displays the following information:          1. /.               waers LIKE konv-waers. the system assumes that there is a standard currency with two decimal places (see 3.  If an arithmetic operation (for example.           kawrt LIKE konv-kawrt. The 'fixed point arithmetic' checkbox in the attributes of the SAPLV61A program is n o t selected. 4.  The system moves the decimal point to the correct place.). 10^N.  In turn. field NETWR). Other Terms Percent. The system always assumes that a currency works with two decimal places. /. the outcome is adjusted by a corresponding correction factor to the correct number of decimal places for the result field (see the following example).  If a currency has a different number of decimal places.                                = 144. 3.23  JPY                                   123  JPY                                   1. waers. in the internal table XKOMV) is displayed with two decimal places. Explanations for this subject area: See the section entitled 'Reason and Prerequisites'. in accordance with the currency specified in the reference field. fixed point arithmetic. a) For example. the pricing programs do n o t use the fixed point arithmetic.          WRITE : kbetr CURRENCY '3'. so that they are always displayed correctly. CURR.         waers = '%'.23  EUR                                 0. DEC. in particular 5. in a report. QUAN. KBETR Reason and Prerequisites This is the standard behavior of the R/3 system: 1. comparisons and arithmetic operations. the condition rate in pricing (KONV-KBETR) refers to the KBETR data element. If. /. maintain it in the TCURX table and specify the number of decimal places: a) For example.         WRITE: kbetr CURRENCY waers. The value fields refer to a data type in the ABAP dictionary and this data type determines how the content of the value fields is displayed on the database or in debugging mode. KONV. 2. the condition rate in the KONV database table and in debugging mode (for example. this data element refers to the WERTV6 domain with the following attributes:           Data typeCURR           Length    11        Decimal places2 Therefore.  Therefore. this table contains 'Japanese Yen' (JPY) with no decimal places or 'Tunisian Dinar' (TND) with three decimal places. rounding error. decimal places. the currency '3' is used internally as an alternative currency and this currency is also maintained in the TCURX table with a different number of decimal places (3). waers. the document currency VBAP-WAERK is specified as a reference field for the net value of an order item (table  VBAP.                waers.  As part of a WRITE statement. packed numbers (ABAP type p. the corresponding currency field RV61A-KOEI1 is specified as the reference currency in the ABAP dictionary when defining the KONV database table on the 'Currency/Quantity Fields' tab page. 10.         waers = 'EUR'. . pricing does n o t work with fixed point arithmetic.         WRITE: kbetr. b) For percentage conditions (currency = '%'). the condition currency is used as a reference currency for the condition rate.          waers = 'JPY'. Example: The program (without fixed point arithmetic)     REPORT arithmetical_operations . regardless of the number of predefined decimal places for the underlying ABAP dictionary data types. factor.71 EUR (rounded) Furthermore. Example: The program         REPORT test_decimal_places. that is. For example.

this value is saved in the form of two integer values. 7. d) The processing result is then as follows: ¡ Fixed point arithmetic is activated: Internal display:   A1 = 10000000  B1 = 4                       A2 = 10000000  B2 = 4                       A3 = 12345     B3 = 4                       A4 = 12346     B3 = 4 (the number was                                             rounded off) Numbers displayed:              1.     waers = 'EUR'. 4.          WRITE: '1.        WRITE: '1. For the internal display of packed numbers (data type 'p'): Example: a) Declaration of a packed number with four decimal places: DATA: number TYPE p DECIMALS 4.     kwert = kawrt * kbetr / 1000.52  EUR     Condition rate          0.0000                       1.     WRITE : 'Condition value'. number3.32  EUR To achieve greater accuracy.  In the following section.536  %     No adjustment takes place ==> Wrong result:     Condition value        75. waers. waers. /.     waers = 'EUR'.2345'.318. Different display for numbers.23456'.2345                       1.2345" is assigned to this number: number = '1. /.       WRITE: number1.1000 .          kbetr LIKE konv-kbetr.     WRITE: 'Adjustment takes place ==> Correct result:'. /. number2.72  EUR     Adjustment takes place ==> Correct result:     Condition value            75.0000                       1. internally all numbers are saved in the form of two integer values (An. displays the following information:     Condition basis              140.     kawrt = '140. /.36'.Bn). 6.     waers = 'EUR'.     kwert = kawrt * kbetr.     WRITE : 'Condition rate'.000. b) The following values are assigned to the numbers and then displayed: number1 number2 number3 number4 = = = = 1000. waers.000. b) The value "1. c) As was explained in section 6. number4.2346 ¡ Fixed point arithmetic is not activated: Internal display:   A1 =                       A2                       A3                       A4 12345    B1 = = 1000     B2 = 1000     B3 = 123456   B4 4 = 4 = 4 = 4 Numbers displayed:                0. kwert CURRENCY waers. the integer values are A and B: A contains the value of the saved number without a period: '12345' B contains the information about the number of decimal places for the saved number:  '4' d) This reformatting ensures greater accuracy with arithmetic operations because interim results do not have to be rounded off (see section 7). 4. 4. kbetr CURRENCY '3'. kawrt CURRENCY waers.     waers = '%'. deactivate the fixed point arithmetic in pricing (see sections 6 and 7). kwert CURRENCY waers.     WRITE : 'No adjustment takes place ==> Wrong result:'.     kbetr = '5. /. however. c) Internally.            WRITE: '1000'.     WRITE : 'Condition value'.           kwert LIKE konv-kwert. four numbers of the type p are created again: DATA: number1       number2       number3       number4 TYPE TYPE TYPE TYPE p p p p DECIMALS DECIMALS DECIMALS DECIMALS 4. waers. /.2345'.     WRITE : 'Condition basis'. in this example. /. depending on whether or not fixed point arithmetic is activated: Example: a) Also. /. /. /.52'.

.2345                       12. This document is referenced by: SAP Notes (1) 153707   Currency translation miscalculates by 100.                      0. 1000..1000                       1.. Validity This document is not restricted to a software component or software component version References This document refers to: SAP Notes 153707   Currency translation miscalculates by 100. Further questions about the subject area described above are not processed by regular support.3456 Solution Note that this is a consultation note. but by consulting and are subject to separate remuneration. 1000.