Ansicht
Dokumentation

ABAPTYPES_SIMPLE - TYPES SIMPLE

ABAPTYPES_SIMPLE - TYPES SIMPLE

General Material Data   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

TYPES, TYPE abap_type

Short Reference



TYPES ${ ${dtype$[(len)$] TYPE abap_type $[DECIMALS dec$]$}
      $| ${dtype TYPE abap_type $[LENGTH len$] $[DECIMALS dec$]$}$}.

Addition:

... DECIMALS dec

Effect

By specifying a built-in data type abap_type, a non-generic elementary data type is defined. For abap_type, all built-in data types can be used, except for the internal types b and s.

For the ABAP types c, n, p, and x, the length of the data type dtype must be specified by entering a number directly or by specifying a corresponding numeric constant len within the length range defined for the type in question. For all other ABAP types, the length is determined by the value in the tables of built-in ABAP types and no length can be specified in len.

The length len is specified either in parentheses directly after the type name dtype, or after the addition LENGTH. The specified length must be positive. If the length is not specified explicitly for the ABAP types c, n, p, and x, the standard length is defined implicitly.

Notes

  • For reasons of legibility, it is best to always use the addition LENGTH instead of parentheses to specify the length len.
  • The non-specifiable internal types b and s can be achieved by referencing the built-in data types INT1 and INT2 in ABAP Dictionary.
  • It is not necessary to list all additions in obsolete variants of the above statement since they are added implicitly.

These statements create three elementary data types that are local to the program. Values for the unspecified technical attributes of the built-in types c and p are specified.

Addition

... DECIMALS dec

Effect

In the ABAP type p, the number of decimal places must be defined using the addition DECIMALS and by specifying an unsigned number directly or a corresponding numeric constant dec. The addition cannot be specified in other data types.

A maximum of 14 decimal places can be specified. If the number of decimal places is greater than the number of places or digits calculated from 2 * len - 1, a syntax check warning occurs. This is because only the last 2 * len - 1 decimal places can be filled with digits.

For the decimal separator to be respected in operations with packed numbers, the program attribute fixed point arithmetic must be set. Otherwise, the addition DECIMALS only affects the output on dynpros and the format for the statement WRITE $[TO$].

Note

If the number of decimal places is greater than the number of digits, the decimal separator is outside the sequence of digits, which should be respected in assignments and outputs. Such a number can raise exceptions in conversions to external formats such as data types of the database in or during serializations to asXML.

Definition of a numeric type for a packed number with three digits and two decimal places. The value range is -9.99 to +9.99 in increments of 0.01.

Example

Defines a numeric type for a packed number with three digits and five decimal places. This statement produces a syntax check warning. The value range is -0.00999 to +0.00999 in increments of 0.00001. Not all decimal places can be used.

TYPES number TYPE p LENGTH 2 DECIMALS 5.






Fill RESBD Structure from EBP Component Structure   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 5463 Date: 20240425 Time: 121959     sap01-206 ( 83 ms )