ARTICLE
Suitable Values for Lossless Assignments
When an elementary argument of the operator
EXACT is converted to an
incompatible data type, the argument must contain a value suitable for
the target type as shown in the following tables. This avoid loss of
values and provides a valid value for the target type.
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 determined after applying
the conversion rules are permitted
if their value lies within the value range and does not have to be
rounded. Arguments of type c or string are also permitted
if they contain only blanks or empty strings. Arguments of type n
can contain as many digits after leading zeros that are permitted
within the value range. In arguments of types d and t , all
valid date and time
specifications are permitted; however 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 .
Byte-like data type Not allowed
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 permitted. In arguments of types
int8 ,
p , decfloat16 , and decfloat34 , a maximum of 15
decimal digits, but no decimal places are permitted. 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
, numbers can be expressed in
scientific notation . The values are integers with a maximum of 15
digits. Arguments of type c or string are also permitted
if they contain only blanks or empty strings. Arguments of type n
can contain up to 15 digits after leading zeros. In arguments of types
d and t , all valid
specified dates and times are permitted. Inappropriate values raise an
exception from class
CX_SY_CONVERSION_INEXACT_FLTP .
Byte-like data type Not allowed
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; 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 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 .
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.
Target type of type n
Argument Suitable Values
Numeric data type Positive
integers including 0, in which the 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
sequence of digits that cannot be longer than the target type (excluding
the leading zeros). Arguments of type c and string can
contain additional leading and trailing blanks. 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
.
Byte-like data type Not allowed
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
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 specified
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
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 permitted; the only
exception is that trailing blanks in arguments of type c are
ignored. Arguments of types n , d , and t are not
permitted. 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 .
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 permitted; the only exception is that
trailing blanks in arguments of type c are ignored. Arguments of
types n , d , and t are not permitted. Inappropriate
values raise an exception from class
CX_SY_CONVERSION_NO_RAW .
Byte-like data type A byte chain
of any length.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved