четверг, 23 апреля 2015 г.

Пример использования программы в процессе "удаление перекр. запросов"

Delete Existing request in Cube of two years before data using ABAP

*Defined the ccupeaka data types as the timestamp calculation module
*requires this data types
  DATA i_date LIKE  ccupeaka-timestamp.
  DATA i_request_date LIKE  ccupeaka-timestamp.
  DATA i_diff_sec TYPE i.
  DATA i_diff_day TYPE i.
  DATA i_request_tm LIKE rsreqdelstruc-timestamp.


*Define here the retention period in days
  DATA c_retention_day TYPE i VALUE 70.

  i_date+0(8) = sy-datum.
  i_date+8(6) = '000000'.

  LOOP AT l_t_request_to_delete.
    i_request_tm = l_t_request_to_delete-timestamp.
    i_request_date = i_request_tm.

    CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'
      EXPORTING
        timestamp1 = i_date
        timestamp2 = i_request_date
      IMPORTING
        difference = i_diff_sec.


*Get the day difference:
    i_diff_day = i_diff_sec / 24 / 3600.


*Exclude all request that are within the retention time

    IF i_diff_day LE c_retention_day.
      DELETE l_t_request_to_delete.
     ENDIF.

  ENDLOOP.

Комментариев нет:

Отправить комментарий