Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - DEFINE VIEW →  ABAP CDS - SELECT →  ABAP CDS - SELECT, Built-In Functions →  ABAP CDS - Special Functions →  ABAP CDS - Date Functions and Time Functions 

ABAP CDS - Time Functions

Other versions: 7.31 | 7.40 | 7.54

Syntax

... TIMS_IS_VALID(time) ...

Variants

1. ... TIMS_IS_VALID(time)

Effect

In a CDS view, these functions execute operations with arguments of the built-in data type TIMS. The functions have positional parameters to which actual parameters need to be assigned when called. There are currently no optional parameters. Suitable fields of a data source, literals, parameters, path expressions, built-in functions, or expressions can all be specified as actual parameters. If an actual parameter contains the null value, every function except TIMS_IS_VALID returns a null value.


Note

It is not currently possible to access the current system time directly in a CDS view. Instead, a CDS view can be given an appropriate input parameter. The special annotation @Environment.systemField makes it possible to pass the value of the ABAP system field sy-uzeit to this parameter.

Variant 1

... TIMS_IS_VALID(time)

Effect

The function TIMS_IS_VALID determines whether time (if specified) contains a valid time in the format HHMMSS. The actual parameter must have the built-in data type TIMS. The result has the data type INT4. A valid date produces the value 1 and all other input values (including the null value) produce the value 0.


Example

The following CDS view applies time functions in the SELECT list to columns of the database table DEMO_EXPRESSIONS. The program DEMO_CDS_TIME_FUNCTIONS uses SELECT to access the view. The column TIMS1 of the database table can be given any values.

@AbapCatalog.sqlViewName: 'demo_cds_timfnc'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view demo_cds_time_functions
as select from
demo_expressions
{
id,
tims1 as time1,
tims_is_valid(tims1) as valid1
}