Application Development and Automation 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: 
Read only

What is the use of inverted date format

Former Member
0 Kudos
10,914

In table TCURR - Exchange rates, the field GDATU - Date As of Which the Exchange Rate Is Effective is stored as an inverted date. So 01/01/2008 is actually stored as 79919898.

What is the use of inverted dates. Why does SAP use them. Why not just use normal date format? If I want the latest record from the table, instead of sorting by descending, I actually have to sort by ascending because the date is stored in inverted format.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
4,285

Hi,

Inverted date is a old concept which helps in soring the dates sometimes. but now ASCENDING and DESCENDING sorting is more easy and quick. Check this application help. maybe useful for you



1. CONVERT DATE f1 INTO INVERTED-DATE f2. 
2. CONVERT INVERTED-DATE f1 INTO DATE f2. 


Effect 
Calculates the nine's complement of the internal date format (YYYYMMDD - for more information about internal display, meaning and initial values of types, see TYPES) and places it in the field f2. For example, 19950511 becomes 80049488 and 80049488 becomes 19950511. 
In the inverse date format, the most recent date has the numerically smallest value. You can make use of this effect when sorting dates. 



Note 
The technique of manipulating the sort sequence of dates by inverting the internal date format is now rarely used. You can sort internal tables in order of ascending or descending date values much more efficiently using the ... ASCENDING or ... DESCENDING additions to the SORT statement. 



Example
DATA DATE_INV LIKE SY-DATUM. 
CONVERT DATE SY-DATUM INTO INVERTED-DATE DATE_INV. 



Suppose, for example, SY-DATUM contains the date 11.05.1995 in its internal format 19950511. After execution of the CONVERT statement, DATE_INV would contain the internal format 80049488. 

//Kothand

3 REPLIES 3
Read only

Former Member
0 Kudos
4,286

Hi,

Inverted date is a old concept which helps in soring the dates sometimes. but now ASCENDING and DESCENDING sorting is more easy and quick. Check this application help. maybe useful for you



1. CONVERT DATE f1 INTO INVERTED-DATE f2. 
2. CONVERT INVERTED-DATE f1 INTO DATE f2. 


Effect 
Calculates the nine's complement of the internal date format (YYYYMMDD - for more information about internal display, meaning and initial values of types, see TYPES) and places it in the field f2. For example, 19950511 becomes 80049488 and 80049488 becomes 19950511. 
In the inverse date format, the most recent date has the numerically smallest value. You can make use of this effect when sorting dates. 



Note 
The technique of manipulating the sort sequence of dates by inverting the internal date format is now rarely used. You can sort internal tables in order of ascending or descending date values much more efficiently using the ... ASCENDING or ... DESCENDING additions to the SORT statement. 



Example
DATA DATE_INV LIKE SY-DATUM. 
CONVERT DATE SY-DATUM INTO INVERTED-DATE DATE_INV. 



Suppose, for example, SY-DATUM contains the date 11.05.1995 in its internal format 19950511. After execution of the CONVERT statement, DATE_INV would contain the internal format 80049488. 

//Kothand

Read only

0 Kudos
4,285

SAPでは、逆日付(inverted date)はしばしば内部処理やデータ格納の際に使用されます。

これは、特定の日付までの残りの日数を計算するための手法です。これにより、日付の比較や計算が容易になることがあります。

たとえば、TCURRテーブルのGDATUフィールドでは、実際の日付を「逆日付」として格納します。
これは、特定の「基準日」(SAPでは一般的に99991231、つまり9999年12月31日)から実際の日付を引いた値です。
この方法で、日付が数値として格納され、内部で効率的に処理されます。

Read only

0 Kudos
4,285

Why posting in Japanese on a question posted in English?

Translation:

  • In SAP, inverted dates are often used for internal processing and data storage.
  • This is a technique for calculating the number of days remaining until a certain date. This may make date comparisons and calculations easier.
  • For example, the GDATU field in the TCURR table stores actual dates as "reverse dates."
  • This is a specific "base date" (typically 99991231 in SAP, i.e. December 31, 9999) minus the actual date.
  • This way dates are stored as numbers and processed internally efficiently.