Ansicht
Dokumentation

ABENBUILT_IN_TYPES_VALUES - BUILT IN TYPES VALUES

ABENBUILT_IN_TYPES_VALUES - BUILT IN TYPES VALUES

General Material Data   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

Value Ranges and Initial Values

The following table shows the value ranges and initial values of the predefined ABAP types. For the data types n, d, and t, the valid values are a subset of their value range. ABAP statements that work with data objects of these types are only guaranteed to function correctly for operands with valid values.

When a data object is created, the start value is set to the initial value, if no other value is specified. In the table, it is evident that the initial value of the predefined ABAP type d is not a valid date. In the input and output fields of dynpros, an initial date field is displayed as empty.

Type Value Area Initial Value
b 0 to 255 0
c Any alphanumeric character " " for every position
d Any eight alphanumeric characters; only those values are valid, however, that are valid as dates according to the calendar rules in the format "yyyymmdd": "yyyy" (year): 0001 to 9999, "mm" (month): 01 to 12, "dd" (day): 01 to 31 "00000000"
decfloat16 Decimal floating point numbers of this type are represented internally with 16 decimal places in accordance with the IEEE-754-2008 standard; valid values are numbers between 1E385(1E-16 - 1) and -1E-383 for the negative range, 0 and +1E-383 to 1E385(1 - 1E-16) for the positive range. Values lying between the ranges form the subnormal range and are rounded; outside of the subnormal range, each 16-digit decimal number can be represented precisely with such a decimal floating point number 0
decfloat34 Decimal floating point numbers of this type are represented internally with 34 decimal places in accordance with the IEEE-754-2008 standard; valid values are numbers between 1E6145(1E-34 - 1) and -1E-6143 for the negative range, 0 and +1E-6143 to 1E6145(1 - 1E-34) for the positive range. Values lying between the ranges form the subnormal range and are rounded; outside of the subnormal range, each 34-digit decimal number can be represented precisely with such a decimal floating point number 0
f Binary floating point numbers are represented internally with 16 decimal places in accordance with the IEEE-754 standard (double precision). Valid values are numbers between 1.7976931348623157EE+308 and -2.2250738585072014EE-308 for the negative range and between +2.2250738585072014EE-308 and +1.7976931348623157EE+308 for the positive range as well as 0. Both validity intervals are extended in the direction of zero with denormalized numbers in accordance with the IEEE-754 standard. Not every 16-digit number can be represented precisely with a binary floating point number 0
i -2,147,483,648 to +2,147,483,647 0
n Any alphanumeric characters; however, valid values are only the digits 0 to 9 "0" for every position
p The valid length for packed numbers is between 1 and 16 bytes; two decimal places are packed into one byte, whereby the last byte only contains one place and the plus/minus sign; after the decimal separator, up to 14 decimal places are permitted. Depending on the field length len and the number of decimal places dec, the following applies for the value range: (-10^(2len -1) +1) / (10^(+dec)) to (+10^(2len -1) -1) /(10^(+dec)) in steps of 10^(-dec). Values in between this range are rounded; invalid contents result in undefined behavior. 0
string As for type c Empty string of length 0
s -32,768 to +32,767 0
t Any 6 alphanumeric characters; the only valid values are numbers that are interpreted as a times in the 24-hour clock format "hhmmss". We recommend the exclusive use of 00 to 23 hours for "hh" (hours) and 00 to 59 for "mm" (minutes) and 00 to 59 for "ss" (seconds). "000000"
x Hexadecimal characters 0-9, A-F Hexadecimal 0
xstring As for type x Empty string of length 0

Notes

  • System class CL_ABAP_EXCEPTIONAL_VALUES contains methods that return the minimum and maximum value for a data object.
  • Since the decimal places of a floating point number of type f are represented internally as dual fractions, there is not an exact equivalent for every number that can be represented in the decimal system. This can lead to rounding errors in conversions and intermediate results of calculations. These errors can be avoided by using a two-step rounding procedure.
  • For data objects of data type p, the program attribute Fixed Point Arithmetic must be set so that the decimal separator is taken into account. Otherwise, in all operations, the content is handled as if there is no decimal separator. The sequence of digits in the variables of type p is interpreted as a whole number. Exceptions are:
  • Dynpro displays

  • Conversions to character-like objects with the types c and string

  • The initial value "00000000" of data type d is not a valid date. The zero point of date calculations in ABAP is the valid date 01.01.0001. You must note, however, that a conversion of this date to numeric fields results in the value 0. Conversely, a conversion of the number 0 into a date field does not result in the value "01010001", but in the invalid date "00000000". The smallest number that results in a valid date when converted into a date field is 1, which results in the date 02.01.0001.
  • Data objects with the data type t that contain numbers outside the value range 00 to 23 for hours and 00 to 59 for minutes and seconds can be converted to numeric values, but are invalid when using time stamps.
  • For decimal floating point numbers, the ABAP runtime environment uses runtime modules of decNumber (c) Copyright IBM Corporation 2001, 2004. All rights reserved.

Example

According to the formula in the table, the value range of a packed number with length 2 and two decimal places is (-10^(2x2 -1) +1) / (10^2) to (+10^(2x2 -1) -1) / (10^2) and therefore =-9.99 to +9.99 in steps of 0.01. A value within this range, for example, 1.428, is rounded up to 1.43.

DATA: pack   TYPE p LENGTH 2 DECIMALS 2,
      result TYPE REF TO data.

FIELD-SYMBOLS <result> TYPE ANY.

result = cl_abap_exceptional_values=>get_min_value( pack ).

IF result IS NOT INITIAL.
  ASSIGN result->* TO <result>.
  WRITE <result>.
ENDIF.

result = cl_abap_exceptional_values=>get_max_value( pack ).

IF result IS NOT INITIAL.
  ASSIGN result->* TO <result>.
  WRITE <result>.
ENDIF.





Addresses (Business Address Services)   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 9727 Date: 20240427 Time: 003440     sap01-206 ( 84 ms )