SAP CONVERSION TYPE P



Get Example source ABAP code based on a different SAP table
  



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.
ITOC

Numeric Target Fields TargetConversion i, int8, (b, s)The value of the packed number is rounded commercially 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. Otherwise, the catchable exception CX_SY_CONVERSION_OVERFLOW is raised. pThe value of the packed number is rounded commercially to the number of decimal places of the target field. If this number is within the value range for the data type of the target field, it is converted to the internal representation of this packed number. Otherwise, the catchable exception CX_SY_CONVERSION_OVERFLOW is raised. decfloat16, decfloat34The value of the packed number is converted into the internal format of a decimal floating point number. If the number of 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 catchable exception CX_SY_CONVERSION_NO_NUMBER. fThe 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.

ABAP_EXAMPLE_VX5
The result of the following conversion has the value 8.1499999999999995E-01.
ABEXA 00943
ABAP_EXAMPLE_END

Character-Like Target Fields TargetConversion cThe value of the packed number is formatted in commercial notation and passed right-aligned to the target field. The character - is set in the last position for a negative value and a blank is set in the last place for a positive value. If the target field is longer than the string of digits, including the plus/minus sign, it is padded with blanks on the left. If it is too short, the number representation is moved to the right by one position for positive values. If the target field is still too short (and for negative values), it is truncated on the left and the character * is set in the first position of the target field. nThe value of the packed number is rounded commercially to an integer number. The absolute value is passed to the target field as a right-aligned string of digits. If the target field is longer than the string of digits, the field is padded with zeros on the left. If it is too short, the values on the left are cut off. stringThe value of the packed number is formatted in commercial notation and passed to the target field without gaps. The character - is set in the last position for a negative value and a blank is set in the last position for a positive value. The resulting length of the target field is determined by the number of digits, plus the places for the plus/minus sign and the decimal separator.



Latest notes:

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 string of digits is assigned.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The string resulting from the conversion is 123.456-.
ABEXA 00944
ABAP_EXAMPLE_END

Byte-Like Target Fields TargetConversion xThe content of the source field is first converted to data type i (see above) and then to type x (see conversion table for source field type i, int8, (b, s)). xstringThe content of the source field is first converted to data type i (see above) and then to type xstring (see conversion table for source field type i, int8, (b, s)).

ABAP_EXAMPLE_VX5
The byte chain resulting from the conversion is 0000007C and matches the result of the conversion of the rounded number 124.
ABEXA 00945
ABAP_EXAMPLE_END

Date/Time Fields as Target Fields TargetConversion dThe content of the source field is first converted to data type i (see above) and then to type d (see conversion table for source field type i, int8, (b, s)). tThe content of the source field is first converted to data type i (see above) and then to type t (see conversion table for source field type i, int8, (b, s)). utclongNot supported. Produces a syntax error or raises the exception CX_SY_CONVERSION_NOT_SUPPORTED .



Latest notes:

The method TSTMP2UTCLONG of the class CL_ABAP_TSTMP converts time stamps in packed numbers to time stamp fields of the type utclong.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The value of the date field resulting from the conversion is 20170111 .
ABEXA 00946
ABAP_EXAMPLE_END