ABAP Keyword Documentation →  ABAP − Reference →  Obsolete Language Elements →  Obsolete character string and byte string processing → 

CONVERT - INVERTED-DATE  Syntax Diagram

Short Reference

Obsolete Syntax

CONVERT { {DATE dat1 INTO INVERTED-DATE dat2}
        | {INVERTED-DATE dat1 INTO DATE dat2} }.

Effect

These variants of the CONVERT statement are not permitted in classes. They convert the numbers 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.

Notes

dat2 = dat1.
TRANSLATE dat2 USING '09182736455463728190'.

Example

The following program section sorts the internal table sflight_tab in descending order by the fldate column.

DATA sflight_tab TYPE TABLE OF sflight.

FIELD-SYMBOLS <sflight_wa> TYPE sflight.

SELECT * FROM sflight INTO TABLE sflight_tab.

LOOP AT sflight_tab ASSIGNING <sflight_wa>.
  CONVERT DATE <sflight_wa>-fldate
    INTO INVERTED-DATE <sflight_wa>-fldate.
ENDLOOP.

SORT sflight_tab BY fldate.

LOOP AT sflight_tab ASSIGNING <sflight_wa>.
  CONVERT INVERTED-DATE <sflight_wa>-fldate
     INTO DATE <sflight_wa>-fldate.
ENDLOOP.

The last nine lines can be replaced by a single line:

SORT sflight_tab BY fldate DESCENDING.

Exceptions

Non-Catchable Exceptions