Get Example source ABAP code based on a different SAP table
• CONVERT DATE INTO INVERTED-DATE ABAP Statement • CONVERT INVERTED-DATE INTO DATE ABAP Statement
CONVERT>, DATE>, INVERTED-DATE> Short Reference >
ABAP_SYNTAX_OBS CONVERT ${ ${DATE dat1 INTO INVERTED-DATE dat2$}> $| ${INVERTED-DATE dat1 INTO DATE dat2$} $}.>
What does it do? These variants of the statement CONVERT> are not allowed in classes. They convert the digits in a character-like data object in dat1> into their complement on nine (the difference to the number nine) and assign the result to the data object dat2>. The data objects dat1> and dat2> must have a flat> character-like data type with length 8. The same data object can be specified for dat2> as for dat1>.
Latest notes:
These forms of the statement CONVERT> are not allowed in classes. They were previously used for sorting by date fields in internal tables and extracts> for changing the sort direction. These have now been replaced by the additions ASCENDING> and DESCENDING> of the statement SORT>>. If necessary, the complement on nine can be formed using the following TRANSLATE>> statement: dat2 = dat1. TRANSLATE dat2 USING '09182736455463728190'.>
The variant of the statement CONVERT DATE> shown here must not be confused with the statements CONVERT DATE ... INTO UTCLONG>>, and CONVERT DATE ... INTO TIME STAMP> > for the conversion to time stamps. ABAP_HINT_END
Example ABAP Coding
The following program section sorts the internal table sflight_tab > in descending order by the fldate> column. ABEXA 00148 The last nine lines can be replaced by a single line: SORT sflight_tab BY fldate DESCENDING.> ABAP_EXAMPLE_END
Runtime Exceptions
Non-catchable Exceptions
Reason for error:
Conversion not possible due to invalid field length