ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Date and Time Processing → System Fields for Date and Time
GET TIME
Other versions: 7.31 | 7.40 | 7.54
Syntax
GET TIME [FIELD tim].
Addition
Effect
Without the addition FIELD
, the
system fields for date and time, sy-datlo
,
sy-datum
, sy-timlo
, and sy-uzeit
,
are set to the current value. The content of the system fields sy-dayst
,
sy-fdayw
, sy-tzone
, and sy-zonlo
is not updated.
Note
Except for GET TIME
, the system fields are updated after starting a program, after sending a
screen, and after changing the
internal session.
Example
Approximate runtime measurement. The statement GET RUN TIME
should be used instead.
GET TIME.
DATA(t1) = sy-timlo.
DO 5000000 TIMES.
ENDDO.
GET TIME.
DATA(t2) = sy-timlo.
cl_demo_output=>display( t2 - t1 ).
Addition
... FIELD tim
Effect
The addition FIELD
is used to pass the current
system time in the format
"hhmmss" to the variable tim
instead of
sy-uzeit, and none of the system fields are updated. The return value of the statement has data type t
. The following can be specified for tim
:
-
An existing variable of the data type
t
or a variable to which the typet
can be converted. -
An inline declaration
DATA(var)
, where a variable of typet
is declared.
Example
The example has the same function as the previous one.
GET TIME.
DO 5000000 TIMES.
ENDDO.
GET TIME FIELD DATA(time).
cl_demo_output=>display( time - sy-uzeit ).