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

# Source Field Type i, (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 of the ABAP Dictionary that have the
external data types INT1 or INT2.

Other versions:
**7.31** | 7.40 | 7.54

### Numeric Target Fields

Target | Conversion |
---|---|

`i` , (`b` , `s` ) |
If an assignment is made to the same data type, the content is transferred unconverted. Otherwise, the value of the integer is converted to the internal representation of `i` ,(`b` , `s` ). If thevalue range of the internaldata types `i` , `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 treatable 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 the businessnotation and transferred right-justified and without decimal separators into the target field. Thecharacter "-" 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 fieldis filled 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. |

`string` |
The value of the integer is formatted in the business notation and transferred, without gaps and without decimal separators, into the targetfield. The character "-" is set at the last position for a negative value, and a blank is set for apositive 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 transferred as a character string right-aligned tothe target field. If the target field is longer than 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` |
If the value of the integer is between 1 and 3652060, it is interpreted as the number of days since01.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 filled 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 numberof the divide remainder is interpreted 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 you can generate by assigning a number is 02.01.0001 by assigning the number 1.

- Converting 577736 to a target field of type
`d`

produces 4.10.1582, and converting 577737 produces 15.10.1582. The dates for the intermediate days lost during the switch from the Julian to the Gregorian calendar cannot be obtained by assigning a numerical value to a target field of type`d`

.

### Byte-Type Target Fields

Target | Conversion |
---|---|

`x` |
Data objects of the types `b` or `s` are convertedin the internal representation from data type `i` . The 4 bytes of the data type `i` are positioned in the target field so that they are right-justified and inbig endian sequence. Ifthe target field is too long, it is filled 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 convertedin the internal representation from data type `i` . The 4 bytes of the data type `i` are positioned in the target field so that they are inbig endian sequence. Inthis representation, positive values occupy 1, 2, 3, 4, or 8 bytes. Negative values always require 4or 8 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 1 byte for data type `b` ,1, 2, or 4 bytes for data type `s` , and 1, 2, 3, or 4 bytes for data type `i` . Notes |

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 that you obtain
the required result, we recommend that you only convert data types `i`

,
b, and `s`

in fields of type `x`

and length
4 and work with this. For example, negative values in a field of data type `s`

always require 4 bytes during the conversion to `x`

or `xstring`

and not the potentially expected 2 bytes, resulting in unexpected results in the target field of length 2.

Example