Function documentation Data Types in the ABAP Dictionary 

Use

The data type in the ABAP Dictionary is the user’s view of the data, that is, the data format at the user interface. This data format depends on the database system that you use. When you define a table in the ABAP Dictionary, the data types defined in the ABAP Dictionary are copied to the data types of the database system used.

If an ABAP Dictionary object (data element, structure, table type, table, or view) is used in an ABAP program, the system converts the Dictionary data types of the object fields to the corresponding ABAP data types. You can see an example of such a conversion in the following figure.

This graphic is explained in the accompanying text

Note

Some data types have a predefined length and set templates for output.

Existing Data Types

ACCP: Posting period. The length is set to 6 places for this data type. The format is YYYYMM. In input and output, the system inserts a point between the year and month, so the template of this data type has the format ‘____.__’.

CHAR: Character string. Fields of type CHAR can have a maximum length of 1333 in tables. If you want to use longer character fields in tables, you must choose data type LCHR. There are no restrictions on the length of such fields in structures.

CLNT: Client. Client fields always have three places.

CUKY: Currency key. Fields of this type are referenced by fields of type CURR. The length is set to 5 places for this data type.

CURR: Currency field. Equivalent to an amount field DEC. A field of this type must refer to a field of type CUKY (reference field). The maximum length for this data type is 31 places.

DATS: Date. The length is set to 8 places for this data type. The output template can be defined with the user profile.

DEC: Counter or amount field with decimal point, sign, and commas separating thousands. A DEC field has a maximum length of 31 places.

FLTP: Floating point number. The length (including decimal places) is set to 16 places for this data type.

DF34_RAW: Normalized decimal floating point number. Representation on the database based on type RAW. The values can be sorted and compared according to their numerical value, and they can be used in indexes. Database arithmetic is not available. Decimal floating point numbers of this type have 34 digits in the mantissa, and conform to the IEEE 754r standard. Valid values are numbers between 1E-6143 and 9.999999999999999999999999999999999E+6144, plus the corresponding negative numbers and zero.

DF34_SCL: Scaled decimal floating point number. The difference between this type and DF34_RAW is that DF34_SCL has an additional column of the type INT2 for the scale. This column is visible, but its value is written and read automatically. The values having this data type can be sorted and compared according to their numerical value, and they can be used in indexes. Database arithmetic is not available. The system supports up to 34 decimal digits in the coefficient. Decimal floating point numbers of this type are represented internally with 34 decimal places according to the IEEE-754 standard. Valid values are numbers between 1E-6143 and 9.999999999999999999999999999999999E+6144, plus the corresponding negative numbers and zero.

DF34_DEC: Decimal floating point number. Representation on the database with type DEC, length and number of decimal places must be specified by the programmer. The values have at most 31 digits on the database, with at most 14 decimal places. The advantage of this type is that database arithmetic is available. The disadvantage is that values are silently rounded to the specified number of decimal places when they are written into the database. An overflow can also occur when writing values into the database. In this case the system throws an ABAP-OO exception.

DF16_RAW: Normalized decimal floating point number. Representation based on type RAW. The values can be sorted and compared according to their numerical value, and they can be used in indexes. Database arithmetic is not available. The system supports up to 16 decimal digits in the coefficient. Decimal floating point numbers of this type are represented internally with 16 decimal places according to the IEEE-754r standard. Valid values are numbers between 1E-383 and 9.999999999999999E+384, plus the corresponding negative numbers plus zero.

DF16_SCL: Scaled decimal floating point number. The difference between this type and DF16_RAW is that DF16_SCL has an additional column of type INT2 for the scale. This column is visible, but the value is written and read automatically. The values having this data type can be sorted and compared according to their numerical value, and they can be used in indexes. Database arithmetic is not available. The system supports up to 16 decimal digits in the coefficient. Decimal floating point numbers of this type are represented internally with 16 decimal places according to the IEEE-754r standard. Valid values are numbers between 1E-383 and 9.999999999999999E+384, plus the corresponding negative numbers plus zero.

DF16_DEC: Decimal floating point number. Representation on the database with type DEC, length and number of decimal places must be specified by the programmer. The values have at most 15 digits on the database, with at most 14 decimal places. The advantage of this type is that database arithmetic is available. The disadvantage is that values are silently rounded to the specified number of decimal places when they are written into the database. An overflow can also occur when writing values into the database. In this case, the system throws an ABAP-OO exception.

INT1: 1-byte integer between 0 and 255. The length is set to 3 places for this data type.

INT2: 2-byte integer between -32767 and 32767. Fields of this type must be used only for length fields. The system positions these length fields immediately in front of a long field (type LCHR, LRAW). With INSERT or UPDATE on the long field, the database interface enters the length which was actually used in the length field. The length is set to 5 places for this data type.

INT4: 4-byte integer between -2147483648 and 2147483647. The length for this data type is limited to 10 places.

LANG: Language key. It has its own field format for special functions. This data type always has length 1. The language key is displayed at the user interface with 2 places, but is stored with 1 place in the database. The conversion exit ISOLA converts the display at the user interface for the database and vice versa. This conversion exit is automatically allocated to a domain with data type LANG at activation.

LCHR: Character string of any length, but has to be declared with a minimum of 256 characters. You must locate fields of this type at the end of transparent tables (in each table there can be only one such field) and must be preceded by a length field of type INT2. If there is an INSERT or UPDATE in ABAP programs, this length field must be filled with the length actually required. If the length field is not filled correctly, this leads to a data loss in the LCHR field. Fields of this type cannot be used in the WHERE condition of a SELECT statement.

LRAW: Uninterpreted byte string of any length, but has to be declared with a minimum length of 256. You must locate fields of this type at the end of transparent tables (in each table there can be only one such field) and must be preceded by a length field of type INT2. If there is an INSERT or UPDATE in ABAP programs, this length field must be filled with the length actually required. If the length field is not filled correctly, this leads to a data loss in the LRAW field. A field of this type cannot be used in the WHERE condition of a SELECT statement.

NUMC: Long character field in which only numbers can be entered. The length of this field is limited to a maximum of 255 places.

PREC: Obsolete data type. The length is set to 2 places for this data type but internally it is treated like INT2. Dynpro fields of type PREC are restricted to 2 places and must not contain a sign.

QUAN: Quantity. Equivalent to an amount field DEC. A field of this type must always refer to a units field with UNIT format (reference field). The maximum length for this data type is 31 places.

RAW: Uninterpreted byte string. Fields of type RAW may have only a maximum length of 255 in tables. If longer raw fields are required in tables, you should select data type LRAW.

RAWSTRING: Uninterpreted byte string of variable length. In the Dictionary a length can be specified for this type (at least 256 characters). This data type can be used in types (data elements, structures, table types) and domains. You can store binary data of type RAWSTRING in the database. There are restrictions; for a description of them, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. The system proposes 132 characters as the default for the output length. You cannot attach search helps to components of this type.

STRING: Character string with variable length This data type can be used only in types (data elements, structures, table types) and domains. In the dictionary a length can be specified for this type (at least 256 characters). It can be used in database tables only with restrictions. For a description of them, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. The system proposes 132 characters as default for the output length. You cannot attach search helps to components of this type.

SSTRING: Short character string with variable length. In the Dictionary the number of characters can be specified for this type (from 1 to 1333). This data type can be used only in types (data elements, structures, table types) and domains. It can be used in database tables. To do so, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. String fields of this type can be used in indexes and in the WHERE condition of a SELECT statement. You cannot use them in table keys.

TIMS: Time. The length is set to 6 places for this data type. The format is HHMMSS. The template for input and output has the form ‘__.__.__’.

UNIT: Unit. Fields of this type are referenced by fields of type QUAN. The length of this data type is set to 2 or 3 places.

VARC: Character field of variable length. Creation of new fields of this data type is no longer supported.

Notes

  When using the numeric data types CURR, DEC, FLPT, INT2, INT4 and QUAN, you can choose whether or not a sign must be output on screens.

  With the data types CURR, DEC and QUAN, the system sets commas separating thousands and decimal points. The output length (number of places plus the number of necessary editing characters such as commas separating thousands and decimal points) is greater than the specified length.

  The system omits editing characters if the output length specified in the domain maintenance is too small.

  The types RAWSTRING and STRING or LOBs have a variable length. You can specify a maximum length, but there is no upper limit.

  The type SSTRING also has a variable length, but there is an upper limit. The maximum length is 1333. The benefit of using it, and not CHAR, is that it is assigned to the ABAP type string. Its advantage over STRING is that it can also be used for key fields in database tables.

  The maximum length of data types that are based on RAWSTRING, STRING, and SSTRING can be determined using the predefined function dbmaxlen.

  The maximum number of characters of the types LCHR and LRAW is the value of a precedingINT2 field in a transparent database table.

  If a data type CURR, DEC, DF34_DEC, DF16_DEC, or QUAN has an even number of characters (not recommend), the length of the associated ABAP type p is rounded up and hence becomes the next highest uneven number.

  The data type PREC is obsolete and you should no longer use it. In ABAP Dictionary and in ABAP programs, it is handled like INT2, despite the predefined length (2). The length 2 is relevant only for screen fields of the type PREC, which can have two-character positive values at most. The property sign cannot be set for a domain of the type PREC

Caution

A column of type DF16_SCL or DF34_SCL cannot occur in the primary key.

See also:

Mapping of the ABAP Data Types

Predefined ABAP Types