ABAP Keyword Documentation → ABAP - Reference → Assignments → Assignment Rules → Conversion Rules for Elementary Data Objects → Numeric Source Fields
Source Field Type p
If the program property
fixed point arithmetic is not set, the decimal separator in source fields
with the type p
is ignored, except in assignments to character-like target fields with the types c
and string
.
Other versions: 7.31 | 7.40 | 7.54
Numeric Target Fields
Target | Conversion |
---|---|
i , (b , s ) |
The value of the packed number is arithmetically rounded to an integer number. If this number is within thevalue range for the data type i ,(b , s ), it is converted to the internal representationof the corresponding integer number. If the number is not within this range, the treatable exception CX_SY_CONVERSION_OVERFLOW occurs. |
p |
The value of the packed number is arithmetically rounded to the number ofdecimal places ofthe target field. If this number is within the value area for the data type of the target field, itis converted to the internal representation of a packed number. If the number is not within this range, the treatable exception CX_SY_CONVERSION_OVERFLOW occurs. |
decfloat16 , decfloat34 |
The value of the packed number is converted into the internal format of a decimal floating pointnumber. If the number of decimal places for a target field of type decfloat16 is greater than 16 when the assignment is performed, commercial rounding to 16 places is applied. If the mantissa of the target field is long enough, thescaling is set to the number ofdecimal places ofthe source field. An invalid value in the source field results in the treatable exception CX_SY_CONVERSION_NO_NUMBER. |
f |
The value of the packed number is converted into the internal format of a binary floating pointnumber. If the decimal number cannot be represented as a binary floating point number, the nearest value is used. An invalid value in the source field results in undefined behavior. |
Character-Like Target Fields
Target | Conversion |
---|---|
c |
The value of the packed number is prepared asa numerical value and transferred to the target field,flush left. The character "-" is set at the last position for a negative value, and a blank is set fora positive value. If the target field is longer than the sequence of digits, including the plus/minussign, the field is filled with blanks to the left. If it is too short, the number representation ismoved to the right - in the case of positive values. If the target field is still too short (and inthe case of negative values), the field is cut off to the left and the character "*" is set to the first position of the target field. |
string |
The value of the packed number is prepared asa numerical valueand transferred to the target field, flush left. The character "-" is set at the last position for anegative value, and a blank is set for a positive value. The resulting length of the target field isdetermined through the number of digits, in addition to the positions for the plus/minus sign and the decimal separator. |
n |
The value of the packed number is arithmetically rounded to an integer number. The absolute valueis transferred as a character string right-aligned to the target field. If the target field is longerthan the character string, the field is filled with zeros from the left. If it is too short, the values to the left are cut off. |
d |
The content of the source field is converted first to data type i (seeabove) and then to type d (see conversion table for source field type i ,(b , s )). |
t |
The content of the source field is converted first to data type i (seeabove) and then to type t (see conversion table for source field type i ,(b , s )). |
Byte-Like Target Fields
Target | Conversion |
---|---|
x |
The content of the source field is converted first to data type i (seeabove) and then to type x (see conversion table for source field type i ,(b , s )). |
xstring |
The content of the source field is converted first to data type i (seeabove) and then to type xstring (see conversion table for source field type i ,(b , s )). |