Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Assignments →  Assignment and Conversion Rules →  Conversion Rules for Elementary Data Objects →  Numeric Source Fields 

Source Field Type p

If the program attribute 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 handleable exception CX_SY_CONVERSION_OVERFLOW is raised.
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 handleable exception CX_SY_CONVERSION_OVERFLOW is raised.
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 decfloat16is 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 raises the handleable 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 produces 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 padded 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 passed as a right-aligned character string to the target field. If the target field is longer thanthe character string, the field is padded 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 first converted to the data type i(see above), and then to the type d (see the conversion table for source field type i,(b, s)).
t The content of the source field is first converted to the data type i(see above), and then to the type t (see the conversion table for source field type i,(b, s)).


Note

If the number of decimal places in the source field is greater than the number of digits calculated from 2 x the length of dobj - 1, the corresponding number of zeros is inserted between decimal separators and digits in assignments to data objects of the types c and string and the longer sequence of digits is assigned.

Byte-Like Target Fields

Target Conversion
x The content of the source field is first converted to the data type i(see above), and then to the type x (see the conversion table for source field type i,(b, s)).
xstring The content of the source field is first converted to the data type i(see above), and then to the type x (see the conversion table for source field type i,(b, s)).