Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Inverte - Date function in Update Rules

Former Member
0 Kudos

Hi All,

We are writing a code for converting the data into a date field using INVERTE-DATE function.

The field GDATU in the Table TCURR needs to be converted.

GDATU - Date As of Which the Exchange Rate Is Effective. This is not in proper format, hence we used the below code to converte in to a proper one.

TABLES: TCURR.

DATA: tcurr_tab TYPE TABLE OF tcurr.

data: date_normal type sy-datum.

FIELD-SYMBOLS

<tcurr_wa> TYPE tcurr.

SELECT gdatu FROM tcurr INTO corresponding fields of

TABLE tcurr_tab.

SORT tcurr_tab BY gdatu.

LOOP AT tcurr_tab ASSIGNING <tcurr_wa>.

break-point.

CONVERT INVERTED-DATE <tcurr_wa>-gdatu

INTO DATE date_normal. "move that to normal date field

write:/ date_normal. "take a normal date field

ENDLOOP.

when I check for this code... it gives us the below error message

E:Variants with INVERTED-DATE are no longer supported in the OO context.

Use TRANSLATE ... USING '1928374664738291' instead

Can anyone suggest me what could be done to solve this issue.

Thanks,

Maddy

1 REPLY 1

Former Member
0 Kudos

Hi Maddy,

If you do F1 help for 'Inverted-Date' you will get the reason as:

Cannot Convert Dates 

The statements CONVERT DATE and CONVERT INVERTED DATE are not allowed. 

An error message occurs in ABAP Objects if the following syntax is used: 

CONVERT DATE f1 INTO INVERTED-DATE f2. 

CONVERT INVERTED-DATE f2 INTO DATE f1. 

Correct syntax: 

CONSTANTS comp_nine(20) TYPE c VALUE '09182736455463728190'. 

f2 = f1. 
TRANSLATE f2 USING comp_nine. 

f1 = f2. 
TRANSLATE f1 USING comp_nine. 

Reason: 

Date conversions are used mainly to influence the sort sequence in in internal tables. This function can be replaced by the additions ASCENDING or DESCENDING of the statement SORT. If required, you can easily program the nines complement yourself using TRANSLATE.

Regards,

Saba