REPORT Z99_24.

REPORT Z99_24.

TYPES : BEGIN OF t_line,
          col1 TYPE i,
          col2 TYPE i,
        END OF t_line.

DATA : gt_itab TYPE sorted TABLE OF t_line WITH NON-UNIQUE KEY col1 col2,
       gs_str TYPE t_line.

DATA: lv_start_time TYPE timestampl,
      lv_end_time TYPE timestampl,
      lv_duration  TYPE decfloat34.

DO 10000000 TIMES.
  gs_str-col1 = 10000000 – sy-index.
  gs_str-col2 = sy-index.
  INSERT gs_str INTO TABLE gt_itab.
ENDDO.

GET TIME STAMP FIELD lv_start_time.

READ TABLE gt_itab WITH TABLE KEY col1 = 5555555 col2 = 7777777 INTO gs_str.

GET TIME STAMP FIELD lv_end_time.
lv_duration = lv_end_time – lv_start_time.

WRITE: 'Execution time: ', lv_duration, ' milliseconds'.


Leave a Reply