Текущая дата и время в CDS
Создать CDS с текущими датой, временем и мандантом:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
@AbapCatalog.sqlViewName: 'ZBCV_100' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'System values' define view ZI_BC_SY as select from t000 { key mandt, cast (substring( cast( tstmp_current_utctimestamp() as abap.char(17) ), 1, 8 ) as abap.dats) as sydatum, cast(substring( cast( tstmp_current_utctimestamp() as abap.char(17) ), 9, 6 ) as abap.tims) as syuzeit } where t000.mandt = $session.client |
Сделать JOIN в тех местах где требуется получение текущего времени и даты:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
@AbapCatalog.sqlViewName: 'ZSDV_ACIKSIP_005' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'Customer date limit' @ClientDependent: true define view ZI_SD_ACIKSP_CUST_DATE_LIMIT as select from zsdt_aciksp_002 inner join ZI_BC_SY as _sy on _sy.mandt = zsdt_aciksp_002.mandt { key zsdt_aciksp_002.mandt, key vkorg, key kunnr, dats_add_days(_sy.sydatum, day_back * -1, 'FAIL') as date_limit } where zsdt_aciksp_002.mandt = $session.client and is_active = 'X' |