ABAP Keyword Documentation → ABAP - Reference → Processing Internal Data → Assignments → Assignment and Conversion Rules → Conversion Rules for Elementary Data Objects → Character-Like Source Fields
Source Field Type d
The conversion rules are designed in such a way that when data objects of type d
are assigned to character-like data objects they behave as character-like data objects. The latter is the basis for date calculations in arithmetic expressions.
Only date entries in the format "yyyymmdd" are valid for data objects
of type d
, whereby "00010101" is the first valid value. The conversion rules, however, allow the assignment of date fields that contain invalid data. The latter is not recommended.
Other versions: 7.31 | 7.40 | 7.54
Numeric Target Fields
Target | Conversion |
---|---|
i , (b , s ) |
If the source field contains a valid date in the format "yyyymmdd",it is used to calculate the number of days since 01.01.0001, and this value is then converted to theinternal representation of the corresponding integer. If the source field contains an invalid date, the target field is assigned the value 0. If thevalue range for the internaldata types b and s is insufficient, the unhandleable exception CX_SY_CONVERSION_OVERFLOW is raised. |
p |
If the source field contains a valid date in the format "yyyymmdd",it is used to calculate the number of days since 01.01.0001, and this value is then converted to theinternal representation of a packed number. If the value range of the target field is too small, a handleableexception CX_SY_CONVERSION_OVERFLOW is raised. If the source field contains an invalid date, the target field is assigned the value 0. |
decfloat16 , decfloat34 |
If the source field contains a valid date in the format "yyyymmdd",it is used to calculate the number of days since 01.01.0001, and this value is then converted to the internal representation of a decimal floating point number with ascaling of 0. If the source field contains an invalid date, the target field is assigned the value 0. |
f |
If the source field contains a valid date in the format "yyyymmdd",it is used to calculate the number of days since 01.01.0001, and this value is then converted to theinternal representation of a binary floating point number. If the source field contains an invalid date, the target field is assigned the value 0. |
Notes
- The conversion of a date into the number of days since 01.01.001 is designed in such a way that the transition from the Julian to Gregorian calendar is taken into account: 4.10.1582 results in the number 577,736 and 15.10.1582 results in 577,737. Converting the dates of the non-existent days between 5.10.1582 and 14.10.1582 produces the same result as converting the existing days from 15.10.1582 to 24.10.1582.
- The assignment of the values "00000000" and "00010101" to a numeric type results in the value 0 in each case. The assignment of the value 0 to a date field results in "00000000". This means that the assignment of the value "00010101" to a numeric type cannot be reversed.
Character-Like Target Fields
Target | Conversion |
---|---|
c |
Content is handled in the same way as a source field of type c |
string |
Content is handled in the same way as a source field of type c |
n |
The characters in the source field are inserted in the target field, left-aligned. Trailing blanksin the source field are passed. If the target field is longer than the source field, it is padded to the right with the character "0". If the target field is shorter, it is truncated on the right. |
d |
The content of the source field is passed unconverted. |
t |
Not supported. Produces a syntax error or runtime error. |
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 )). |