Ansicht
Dokumentation

ABENCHAR_DATE_TIME_FIELDS_CHARLIKE - CHAR DATE TIME FIELDS CHARLIKE

ABENCHAR_DATE_TIME_FIELDS_CHARLIKE - CHAR DATE TIME FIELDS CHARLIKE

CPI1466 during Backup   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

Character-Like Access to Date Fields and Time Fields

Character-like access to character-like content of date fields and time fields is evaluated in a character-like way. The character-like nature of date fields and time fields can be exploited, for example, to access detailed information. To avoid unexpected results from this type of access, the validity of the content of the date or time fields must be ensured. Most statements and functions used in character string processing are not suitable for processing date fields and time fields because they generally produce invalid content.

Example

The following example demonstrates how substring functions can be used to extract the components year, month, day, hour, minute, and second from date fields and time fields.

DATA: date TYPE d,
      time TYPE t.

DATA: year   TYPE i,
      month  TYPE i,
      day    TYPE i,
      hour   TYPE i,
      minute TYPE i,
      second TYPE i.

date = sy-datlo.
time = sy-timlo.

year   = substring( val = date off = 0 len = 4 ).
month  = substring( val = date off = 4 len = 2 ).
day    = substring( val = date off = 6 len = 2 ).
hour   = substring( val = time off = 0 len = 2 ).
minute = substring( val = time off = 2 len = 2 ).
second = substring( val = time off = 4 len = 2 ).






RFUMSV00 - Advance Return for Tax on Sales/Purchases   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 2089 Date: 20240426 Time: 024337     sap01-206 ( 29 ms )