ABAP - Keyword Documentation →  ABAP - Dictionary →  Predefined Data Types in ABAP Dictionary →  Attributes of the Predefined Dictionary Types →  Special Dictionary Types → 

Currency Fields

A currency field is a component of a structure, database table, or view defined in ABAP Dictionary of type CURR and used to record an amount in a specific currency. The amount is specified as a whole number in the smallest unit of the currency. A currency field must be associated with a currency key of a structure, database table, or view that specifies the currency and the number of decimal places. A currency key is a component of a structure, database table, or view defined in ABAP Dictionary, has the type CUKY, and can contain a currency ID from the database table TCURC.

By default, the number of decimal places for a currency is always two. Currencies with a different number of decimal places must also be entered in the table TCURX, where the number of decimal places can be defined explicitly.


Handling in ABAP Dictionary

A data element of data type CURR is handled as a field of data type DEC and is stored in database tables in the BCD format. When creating a data element or a structure component of the data type CURR in an ABAP Dictionary tool, a number of decimal places other than zero must be defined. The standard value is two fractional digits.

For every structure component of data type CURR, a component of the same structure or of a different structure, database table, or view must be specified when editing the individual component as a reference field with the data type CUKY. This field is the currency key that defines the actual currency. From a technical perspective, the data type CUKY is handled like a type CHAR with length 5.


Handling in Dynpros

For the display of an input/output field of type CURR on a dynpro, the content is displayed as character-like content and in accordance with a type-dependent mask, as for all dynpro fields. Here, the positioning of the decimal point for a currency field of type CURR on a dynpro is completely independent of the number of decimal places specified by the data element in ABAP Dictionary (greater than or equal to one, the default value is two). The number of decimal places on a dynpro is defined as follows:


A dynpro therefore only uses the string of digits of a currency field from the ABAP program (or a conversion routine in between) or just sends this string. Any information about currency keys and decimal places is not passed automatically. It must be ensured that the reference field for PBO is filled with the appropriate value. For PAI, the correct currency key plays a part in the automatic format check. Especially on dynpros in which currency fields are displayed in differing currencies, it must be ensured that the reference field is transported before the currency by using the statements CHAIN and FIELD.

Handling in ABAP Programs

The ABAP type that corresponds to the CURR data type is p. An ABAP data object declared with reference to a dictionary type of type CURR has the number of decimal places defined there (greater than or equal to one and the default is two). These decimal places are respected for all operations and calculations, as for all packed numbers. The only exceptions are the programs for which the program property fixed point arithmetic was not set.

To work correctly with a currency field, all digits in the number must be recorded as currency amounts in the smallest possible currency units, regardless of the number of decimal places. This occurs automatically sometimes, for example, if CURRENCY is used after WRITE [TO] or the formatting option CURRENCY in an embedded expression of a character string template. For other operations, the following restrictions apply:

Accurate results should not be expected when performing critical operations if the number of decimal places in the program does not match the number in the currency.


For currencies, one of the data types for decimal floating point numbers is recommended rather than the data type CURR. The currency-compliant formatting is supported on dynpros by output styles and by style-compatible formatting in ABAP programs. See the executable example.