sapdev logo background
sapdev logo sapdev logo
Comments

SAP CONVERSION TYPE P documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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 .

Numeric Target Fields
Target Conversion
i ,
int8 , ( b , s )The value of the packed number is arithmetically rounded to an integer number. If this number is within the value range for the data type i , (
b , s ), it is converted to the internal representation of 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 of decimal places of the target field. If this number is within the value area for the data type of the target field, it is 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 point number. 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, the scaling is set to the number of decimal places of the 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 point number. 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 as a 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 for a positive value. If the target field is longer than the sequence of digits, including the plus/minus sign, the field is padded with blanks to the left. If it is too short, the number representation is moved to the right - in the case of positive values. If the target field is still too short (and in the 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 as a 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 for a positive value. The resulting length of the target field is determined 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 value is transferred as a character stri
ng right-aligned to the target field. If the target field is longer than the 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 ,
int8 , ( 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 ,
int8 , ( b , s ) ).

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 ,
int8 , ( 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 ,
int8 , ( b , s ) ).
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




CONVERSION_TYPE_N
CONVERSION_TYPE_STRING




comments powered by Disqus