What does it do? These SQL functions perform operations on times with arguments of the built-in data types TIMN, TIMS, and UTCLONG. The first set covers generic functions and the second set covers one function depending on the data type TIMS. The arguments of the functions are specified in parentheses. A blank must be placed after the opening parenthesis and in front of the closing parenthesis. SQL expressions of matching data types can be specified as actual parameters. If an actual parameter contains the null value, every function except IS_VALID and TIMS_IS_VALID returns a null value. IS_VALID and TIMS_IS_VALID return the value 0.
What does it do? The generic function IS_VALID determines whether
the specified date date contains a valid date in the format YYYYMMDD. The actual parameter must have the built-in data type DATN or DATS.
the specified time time contains a valid time in the format HHMMSS. The actual parameter must have the built-in data type TIMN or TIMS.
the specified time stamp utclong contains a valid time stamp in a format like 0001-01-01T00:00:00.0000000. The actual parameter must have the built-in data type UTCLONG . The result has the data type INT4. A valid time and the initial value (for the data types TIMN and TIMS) produce the value 1 and all other input values (including the null value) produce the value 0.
Latest notes: The generic function IS_VALID is also available for date functions and time stamp functions. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Applying the generic function to a time column of the DDIC database table DEMO_EXPRESSIONS. ABEXA 01656 ABAP_EXAMPLE_END
What does it do? The generic function EXTRACT_HOUR extracts the hour of a time or a time stamp. The actual parameter must have the built-in data type TIMN, TIMS, or UTCLONG. The result of the function EXTRACT_HOUR has the data type INT4. The function returns the value 0 for initial input values. If no valid time is passed as a TIMS value, the function EXTRACT_HOUR raises a catchable exception of class CX_SY_OPEN_SQL_DB.
Latest notes:
If one of the built-in data types TIMN or UTCLONG is used, the function EXTRACT_HOUR calls the HANA function EXTRACT.
If the built-in data type TIMS is used, the function EXTRACT_HOUR internally uses the ABAP SQL SUBSTRING function and a CAST expression afterwards. The corresponding rules apply. NON_V5_HINTS ABAP_HINT_END
What does it do? The generic function EXTRACT_MINUTE extracts the minute of a time or a time stamp. The actual parameter must have the built-in data type TIMN , TIMS, or UTCLONG. The result of the function EXTRACT_MINUTE has the data type INT4. The function returns the value 0 for initial input values. If no valid time is passed as a TIMS value, the function EXTRACT_MINUTE raises a catchable exception of class CX_SY_OPEN_SQL_DB.
Latest notes:
If one of the built-in data types TIMN or UTCLONG is used, the function EXTRACT_MINUTE calls the HANA function EXTRACT.
If the built-in data type TIMS is used, the function EXTRACT_MINUTE internally uses the ABAP SQL SUBSTRING function and a CAST expression afterwards. The corresponding rules apply. NON_V5_HINTS ABAP_HINT_END
What does it do? The generic function EXTRACT_SECOND extracts the second of a time or a time stamp. The actual parameter must have the built-in data type TIMN , TIMS, or UTCLONG. The result of the function EXTRACT_SECOND has the data type INT4. The function returns the value 0 for initial input values. If no valid time is passed as a TIMS value, the function EXTRACT_SECOND raises a catchable exception of class CX_SY_OPEN_SQL_DB.
Latest notes:
If one of the built-in data types TIMN or UTCLONG is used, the function EXTRACT_SECOND calls the HANA function EXTRACT.
If the built-in data type TIMS is used, the function EXTRACT_SECOND internally uses the ABAP SQL SUBSTRING function and a CAST expression afterwards. The corresponding rules apply. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Applying the generic functions to time and time stamp columns of the DDIC database table DEMO_EXPRESSIONS. ABEXA 01658 ABAP_EXAMPLE_END
Functions for TIMS
ABAP_SYNTAX ... TIMS_IS_VALID( time ) ...
ABAP_VARIANTS: 1 ... TIMS_IS_VALID( time )
What does it do? This SQL function performs operations with arguments of the built-in data type TIMS.
ABAP_VARIANT_1 ... TIMS_IS_VALID( time )
What does it do? The function TIMS_IS_VALID determines whether the specification time 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 time and the initial value produce the value 1 and all other input values (including the null value) produce the value 0.
Latest notes: NON_V5_HINTS The use of this function requires the ABAP_STRICT_771 strict mode from ABAP_RELEASE ABAP_771 / . ABAP_HINT_END
ABAP_EXAMPLE_VX5 Applying the time function to a time column of the DDIC database table DEMO_EXPRESSIONS. The class CL_DEMO_SQL_TIME_FUNCTIONS executes this access to the table and displays the result. ABEXA 01288 ABAP_EXAMPLE_END