sapdev logo background
sapdev logo sapdev logo
Comments

SAP CONVERSION TYPE IBS documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

Source Field Type i, (b, s)
Quellfeldtyp i, int8 , (b, s)
Types b and s are internal and cannot be specified directly in ABAP statements. Self-defined data types and data objects in ABAP programs have the data types b or s if they have been defined with reference to data elements in ABAP Dictionary that have the
external data types INT1 or INT2 .

Numeric Target Fields
Target Conversion
i ,
int8 , ( b , s )If an assignment is made to the same data type, the content is passed unconverted. Otherwise, the value of the integer is converted to the internal representation of i ,
int8 , ( b , s ) . If the value range
of the internal data types i ,
int8 , b , or s is exceeded, the handleable exception
CX_SY_CONVERSION_OVERFLOW is raised.
p The value of the integer is converted into the internal format of a packed number. If the value range of the target field is too small, a handleable exception CX_SY_CONVERSION_OVERFLOW is raised.
decfloat16 , decfloat34 The value of the integer is converted to internal representation of a decimal floating point number with scaling 0.
f The value of the integer is converted into the internal format of a binary floating point number.

Character-Like Target Fields
Target Conversion
c The value of the integer is formatted in business notation and passed right-aligned and without decimal separators into the target field. 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 (for negative values) and truncated on the left for the types i , ( b , s ) and the character "*" is set at the first position of the target field.
Beim Typ int8 kommt es bei zu kurzem Zielfeld zur Ausnahme
CX_SY_CONVERSION_OVERFLOW .
string The value of the integer is formatted in business notation and passed, without gaps and without decimal separators, to the target field. 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 by the number of digits plus the minus sign or blank character.
n The absolute value of this integer number is passed as a character string and 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 If the value of the integer is between 1 and 3,652,060, it is interpreted as the number of days since 01.01.0001 and the resulting date is put in the target field in the format "yyyymmdd" . If the value lies outside this range, the target field is padded with the character "0".
t The value of the integer is divided by the number of seconds in a day (86,400) and the whole number of the divide remainder is inter
preted as the number of seconds since midnight. The resulting time is put in the target field in the format "hhmmss" .

Notes
  • The assignment of the value 0 to a target field of type d does not result in the value "00010101" for 01.01.0001, but rather in "0000000" for an invalid date. The earliest valid date that can be created by assigning a number is 02.01.0001 by assigning the number 1.

  • Converting 577,736 to a target field of type d results in 4.10.1582, and converting 577,737 results in 15.10.1582. The dates for the intermediate days, which were lost during the switch from the Julian to the Gregorian calendar, cannot be attained by assigning a numerical value to a target field of type d .


  • Byte-Like Target Fields
    Target Conversion
    x Data objects of the types b or s are converted in the internal representation from data type i . The four
    bzw. 8 bytes of the data type i
    und int8 are positioned in the target field so that they are right-aligned and in
    big endian order. If the target field is too long, it is padded to the left with hexadecimal 0s. If it is too short, it is truncated from the left.
    xstring Data objects of the types b or s are converted in the internal representation from data type i . The four bytes of the data type i are positioned in the target field so that they are in big endian order. In this representation, positive values have one, two, three, four, or eight bytes. Negative values always require four or eight bytes. For positive values, the leading zeros before the fourth or eighth byte are not transported. Therefore, the resulting length of the target field is one byte for data type b , one, two, or four bytes for data type s , and one, two, three, or four bytes for data type
    i .
    und 1, 2, 3, 4, oder 8 Byte f�r Datentyp int8 .

    Note
    With the conversion of the data types b and s to x and xstring , it is important to note that during the prior conversion to i and also during the conversion of i to
    xstring , the leading zeros have been truncated. To ensure the result is correct, it is recommended that only the data types i ,
    int8 , b , and s are converted to fields of type x and length 4 and then used. For example, negative values in a field of data type s always require four bytes during the conversion to x
    or xstring and not the potentially expected two bytes, resulting in unexpected results in the target field of length 2.

    Example
    See Conversion of Integer Numbers to Bytes
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




    CONVERSION_TYPE_F
    CONVERSION_TYPE_N




    comments powered by Disqus