
Overlapping intervals
Sliced intervals
Output of CDS after slicing
@AbapCatalog.sqlViewName: 'ZSLICESTARTDATES'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Slicing interval - all start dates'
define view ZSLICE_START_DATES as select from zslice_db
{
//actual start dates
key datab as StartDate
}
union select from zslice_db
{
//start dates generated as end date + 1
key DATS_ADD_DAYS(datbi,1,'UNCHANGED') as StartDate
}
@AbapCatalog.sqlViewName: 'ZSLICEENDDATES'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Slicing interval - all end dates'
define view ZSLICE_END_DATES as select from zslice_db
{
//actual end dates
key datbi as EndDate
}
union select from zslice_db
{
//end dates generated as Start Date - 1
key DATS_ADD_DAYS(datab,-1,'UNCHANGED') as EndDate
}
@AbapCatalog.sqlViewName: 'ZSLICESLICEDSTA'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Slicing interval - extra slices for start dates'
define view ZSLICE_SLICED_START as select from zslice_db
{
//actual original records from database
key type as ConditionType,
key datab as StartDate,
key datbi as EndDate
}
union select from ZSLICE_START_DATES as ExtraStartDates inner join zslice_db as OrigRecords
on OrigRecords.datab <= ExtraStartDates.StartDate //condition period covers this start date
and OrigRecords.datbi >= ExtraStartDates.StartDate
{
//added extra slices - where start date is day before end date of other record
key OrigRecords.type as ConditionType,
key ExtraStartDates.StartDate as StartDate,
key OrigRecords.datbi as EndDate
}
@AbapCatalog.sqlViewName: 'ZSLICESLICEDEND'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Slicing interval - extra slices for end dates'
define view ZSLICE_SLICED_END as select from ZSLICE_SLICED_START
{
//records from CDS with extra slices based on extra start dates
key ConditionType as ConditionType,
key StartDate as StartDate,
key EndDate as EndDate
}
union select from ZSLICE_END_DATES as ExtraEndDates inner join ZSLICE_SLICED_START as SlicedStartRecords
on SlicedStartRecords.StartDate <= ExtraEndDates.EndDate //condition period covers the end date
and SlicedStartRecords.EndDate >= ExtraEndDates.EndDate
{
//adding even more slices with end dates as start date - 1 of other records
key SlicedStartRecords.ConditionType as ConditionType,
key SlicedStartRecords.StartDate as StartDate,
key ExtraEndDates.EndDate as EndDate
}
@AbapCatalog.sqlViewName: 'ZSLICESLICED'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Sliced intervals - final CDS'
define view ZSLICE_SLICED as select from ZSLICE_SLICED_END {
//keeping only shortest slices
key ConditionType,
key StartDate,
min(EndDate) as EndDate
} group by ConditionType, StartDate
@AbapCatalog.sqlViewName: 'ZSLICEPRIORIT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Interval slicing - top priorities'
define view ZSLICE_PRIORITIZED as select from ZSLICE_SLICED {
key StartDate,
key EndDate,
max(ConditionType) as TopPrioConditionType
} group by StartDate, EndDate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |