Get Example source ABAP code based on a different SAP table
Suitable Values for Lossless Assignments When an elementary argument of the operator EXACT>> is converted to an incompatible elementary data type, the argument must contain a value suitable for the target type as shown in the following tables. This avoids loss of values and provides a valid value for the target type. ITOC
Numeric Target Types
Target Type with Numeric Type (Except <(>f<)>)Argument>Suitable Values> Numeric data type>Numbers from the value range of the target type that do not have to be rounded. Inappropriate values raise exceptions from the class CX_SY_CONVERSION_ROUNDING>> or CX_SY_CONVERSION_OVERFLOW>>. character-like data type> Numbers from the value range of the target type that do not have to be rounded. In arguments of type c> or string>, appropriate number representations> according to the conversion rules> are allowed if their value lies within the value range and does not have to be rounded. Arguments of type c> or string> are also allowed if they contain only blanks or empty strings. Arguments of type n> can contain as many digits after leading zeros as fit in the value range. Inappropriate values raise exceptions from the class CX_SY_CONVERSION_ROUNDING>> or CX_SY_CONVERSION_OVERFLOW>>. byte-like data type>Not allowed Date type>, time type>, or time stamp type>In arguments of types d> and t>, all valid> date and times (if specified) are allowed, but they cannot be assigned to the target types b> and s>. Inappropriate values raise exceptions from the class CX_SY_CONVERSION_ROUNDING>> or CX_SY_CONVERSION_OVERFLOW>>. The time stamp type utclong> is not allowed.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because rounding would have to take place. ABEXA 01127 ABAP_EXAMPLE_END
Target Type of Type <(>f<)>Argument>Suitable Values> Numeric data type>Integers with a maximum of 15 digits. In arguments of type i> (b> , s>), all values are allowed. In arguments of types int8> , p>, decfloat16>, and decfloat34>, a maximum of 15 places, but no decimal places are allowed. Inappropriate values raise an exception from class CX_SY_CONVERSION_INEXACT_FLTP>>. character-like data type> Integers with a maximum of 15 digits. In arguments of type c> or string>, numeric representations in scientific notation> are allowed, whose values are integers with a maximum of 15 places. Arguments of type c> or string> are also allowed if they contain only blanks or empty strings. Arguments of type n> can contain up to 15 digits after leading zeros. Inappropriate values raise an exception from class CX_SY_CONVERSION_INEXACT_FLTP>>. byte-like data type>Not allowed Date type>, time type>, or time stamp type>In arguments of types d> and t>, all valid> date and time specifications are allowed. Inappropriate values raise an exception from class CX_SY_CONVERSION_NO_DATE>> or CX_SY_CONVERSION_NO_TIME>> The time stamp type utclong> is not allowed.
ABAP_EXAMPLE_VX5 The second lossfree assignment raises an exception because the value of the argument is not an integer. ABEXA 01128 ABAP_EXAMPLE_END
Character-Like Target Types
Target Type of Type <(>c<)>Argument>Suitable Values> Numeric data type>Numbers for which the result from the conversion> to type c> is not longer than the target type, but the result cannot be rounded. Positive signs represented as blanks are ignored. Inappropriate values raise exceptions from classes CX_SY_CONVERSION_OVERFLOW>> or CX_SY_CONVERSION_ROUNDING>>. character-like data type> Character strings that are not longer than the target type. In arguments of type c>, trailing blanks are ignored. In arguments of type string>, no characters are ignored, including trailing blanks. Inappropriate values raise an exception from class CX_SY_CONVERSION_DATA_LOSS>>. byte-like data type>Byte chains for which the result from the conversion> to type c> is not longer than the target type. Inappropriate values raise an exception from class CX_SY_CONVERSION_DATA_LOSS>>. Date type>, time type>, or time stamp type> Valid> date, time, or time stamp specifications. The result of the conversion must not be longer than the target type. Values that are too long raise an exception from class CX_SY_CONVERSION_DATA_LOSS>>.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because the character string would be truncated. ABEXA 01129 ABAP_EXAMPLE_END
Target Type of Type <(>string<)>Argument>Suitable Values> Numeric data type> Any valid> numbers. character-like data type> Any character strings. Byte-like data type>Any byte chains. Date type>, time type>, or time stamp type>Any valid> date, time, or time stamp information.
ABAP_EXAMPLE_VX5 This program section never raises an exception. ABEXA 01130 ABAP_EXAMPLE_END
Target Type of Type <(>n<)>Argument>Suitable Values> Numeric data type>Positive integers including 0, whose number of digits does not exceed the length of the target type. Inappropriate values raise exceptions from classes CX_SY_CONVERSION_OVERFLOW>> or CX_SY_CONVERSION_ROUNDING>>. character-like data type>A closed string of digits that cannot be longer than the target type apart from leading zeros. Arguments of type c> and string> can contain additional leading and trailing blanks. Inappropriate values raise exceptions from classes CX_SY_CONVERSION_NO_NUMBER>> or CX_SY_CONVERSION_OVERFLOW>>. byte-like data type>Not allowed Date type>, time type>, or time stamp type>. Arguments of type d> and t> cannot contain blanks and the target type must have the same length as the source fields. Inappropriate values raise exceptions from classes CX_SY_CONVERSION_NO_NUMBER>> or CX_SY_CONVERSION_OVERFLOW>>. The time stamp type utclong> is not allowed.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because not enough places are available for all digits. ABEXA 01131 ABAP_EXAMPLE_END
Byte-Like Target Types
Target Type of Type <(>x<)>Argument>Suitable Values> Numeric data type>Not allowed Character-like data type> An even number of characters between 0> and 9> and A> and F> in a closed sequence. The number of bytes represented must correspond exactly to the length of the target type. Other characters are not allowed, with the exception that trailing blanks in arguments of type c> are ignored. Arguments of the type n> are not allowed. Inappropriate values raise exceptions from classes CX_SY_CONVERSION_SRC_TOO_SHORT>>, CX_SY_CONVERSION_DATA_LOSS>>, or CX_SY_CONVERSION_NO_RAW>>. byte-like data type>A byte chain that has exactly the same length as the target type. Inappropriate values raise exceptions from classes CX_SY_CONVERSION_SRC_TOO_SHORT>> or CX_SY_CONVERSION_DATA_LOSS>>. Date type>, time type>, or time stamp type>Arguments of the types d>, t>, and utclong> are not allowed.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because the byte string would be truncated. ABEXA 01132 ABAP_EXAMPLE_END
Target Type of Type <(>xstring<)>Argument>Suitable Values> Numeric data type>Not allowed Character-like data type> An even number of characters between 0> and 9> and A> and F> in a closed sequence. Other characters are not allowed, with the exception that trailing blanks in arguments of type c> are ignored. Arguments of the type n> are not allowed. Inappropriate values raise an exception from class CX_SY_CONVERSION_NO_RAW>>. byte-like data type>A byte chain of any length. Date type>, time type>, or time stamp type>Arguments of the types d>, t>, and utclong> are not allowed.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because the number of characters is uneven. ABEXA 01133 ABAP_EXAMPLE_END
Date/Time Types as Target Types
Target Type of Type <(>d<)>Argument>Suitable Values> Numeric data type>Positive integers between 0 and 3652060 (which corresponds to the date 12/31/9999). Inappropriate values raise exceptions from classes CX_SY_CONVERSION_OVERFLOW>> or CX_SY_CONVERSION_ROUNDING>>. character-like data type> A left-aligned valid date> specification with the format yyyymmdd>. Arguments of type n > and string> can contain these eight digits only. Arguments of type c> can also contain trailing blanks. Inappropriate values raise an exception from class CX_SY_CONVERSION_NO_DATE>>. byte-like data type>Not allowed Date type>, time type>, or time stamp type>Valid date specification in an argument of type d>. An argument of type t> or utclong> is not allowed.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because the date is invalid. ABEXA 01134 ABAP_EXAMPLE_END
Target Type of Type <(>t<)>Argument>Suitable Values> Numeric data type>Positive integers between 0 and 86399 (which corresponds to the time 23:59:59). Inappropriate values raise exceptions from classes CX_SY_CONVERSION_OVERFLOW>> or CX_SY_CONVERSION_ROUNDING>>. character-like data type>A left-aligned valid time> specification with the format hhmmss>. Arguments of type n > and string> can contain only these six digits. Arguments of type c> can also contain trailing blanks. Inappropriate values raise an exception from class CX_SY_CONVERSION_NO_TIME>>. byte-like data type>Not allowed Date type>, time type>, or time stamp type>Valid time specification in an argument of type t>. An argument of type d> or utclong> is not allowed.
ABAP_EXAMPLE_VX5 The second lossless assignment raises an exception because the numeric value exceeds the number of seconds in a day. ABEXA 01135 ABAP_EXAMPLE_END
Target Type of Type <(>utclong<)>Argument>Suitable Values> Numeric data type>Not allowed Character-like data type>A left-aligned valid character-like representation> of a time stamp, such as yyyy-mm-ddThh:mm:ss.fffffff> or an initial value with any number of trailing blanks. Inappropriate values raise an exception from class CX_SY_CONVERSION_NO_DATE_TIME>>. Arguments of type n> are not allowed. byte-like data type>Not allowed Date type>, time type>, or time stamp type>Valid time stamp in an argument of type utclong>. Arguments of type d> or t> are not allowed.
ABAP_EXAMPLE_VX5 A character string composed correctly can be assigned to a time stamp without loss. ABEXA 01136 ABAP_EXAMPLE_END