SAP Database

CONVERT: ABAP Keyword a day

Print This Post Email This Post Written by admin on Nov 29th, 2007 | Filed under: ABAP Keywords

CONVERT

Variants
1. CONVERT DATE f1 INTO INVERTED-DATE f2.
2. CONVERT INVERTED-DATE f1 INTO DATE f2.
Effect
Allows conversion between different formats which do not have their own type (see also MOVE ).
The field f1 is converted from the source format to the target format and placed in f2 .

At present, the following formats are supported:
DATE ==> INVERTED-DATE INVERTED-DATE ==> DATE
Both formats form the nine’s complement of internal date representation, e.g. 19950511 ==> 80049488 or 80049488 ==> 19950511. In inverse date format, the most recent date has the lowest numerical value. This is useful when sorting date specifications.
Note
The technique of modifying the sequence of dates by inverting the internal date format is only used in very rare cases. For example, you can sort internal tables in ascending or descending date order much more elegantly with the additons … ASCENDING bzw. … DESCENDING of the SORT statement.
Example
DATA DATE_INV LIKE SY-DATUM.
CONVERT DATE SY-DATUM INTO INVERTED-DATE DATE_INV.

If, for example, the internal representation of 11.05.95 in SY-DATUM is 19950511, the value of DATE_INV after execution of the CONVERT statement is 80049488.
Note

Runtime errors
* CONVERT_ILLEGAL_CONVERSION : Conversion not possible due to incorrect field length.

———————
ABAPer, mail: abap.community@gmail.com http://abaplearner.blogspot.com

If you like this post, you may as well like these too:

  1. APPEND: ABAP Keyword a day APPEND Variants: 1. APPEND [wa TO|INITIAL LINE TO] itab. 2. APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2. 3. APPEND [wa TO] itab SORTED BY f.Variant 1...
  2. How to convert spool to PDF? Run the program RSTXPDFT4 and key in the Spool request no. This program will convert the spool to PDF and download the file locally. ...
  3. EXTRACT : ABAP Keyword a day EXTRACT Basic form EXTRACT fg. Effect Writes all fields of the field group fg (see FIELD-GROUPS) as one record to a sequential dataset (paging). If a field group HEADER...
  4. DATA : ABAP Keyword a day DATA Variants1. DATA f.2. DATA f(len).3. DATA: BEGIN OF rec,…END OF rec.4. DATA: BEGIN OF itab OCCURS n,…END OF itab.5. DATA: BEGIN OF COMMON PART c,…END OF COMMON PART.EffectDefines...
  5. AT : ABAP Keyword a day AT Events in lists- AT LINE-SELECTION.- AT USER-COMMAND.- AT PFn.Events on selection screens- AT SELECTION-SCREEN.Control break with extracts- AT NEW f.- AT END OF f.- AT FIRST.- AT LAST.-...



Leave a Reply

  • Help Support CRY