@AbapCatalog.sqlViewName: 'IINSPOPAGGR'
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Aggregation on inspection operation lvl'
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType: { dataClass: #MIXED, sizeCategory: #L, serviceQuality: #D }
define view I_InspOperationAggregate
as select from I_InspectionOperation
left outer to one join P_InspOperationAggregate1 on I_InspectionOperation.InspectionLot = P_InspOperationAggregate1.InspectionLot
and I_InspectionOperation.InspPlanOperationInternalID = P_InspOperationAggregate1.InspPlanOperationInternalID
left outer to one join P_Inspoperationaggregate2 on I_InspectionOperation.InspectionLot = P_Inspoperationaggregate2.InspectionLot
and I_InspectionOperation.InspPlanOperationInternalID = P_Inspoperationaggregate2.InspPlanOperationInternalID
left outer to one join P_Inspoperationaggregate3 on I_InspectionOperation.InspectionLot = P_Inspoperationaggregate3.InspectionLot
and I_InspectionOperation.InspPlanOperationInternalID = P_Inspoperationaggregate3.InspPlanOperationInternalID
left outer to one join P_InspOperationAggregate4 on I_InspectionOperation.InspectionLot = P_InspOperationAggregate4.InspectionLot
and I_InspectionOperation.InspPlanOperationInternalID = P_InspOperationAggregate4.InspPlanOperationInternalID
{
key I_InspectionOperation.InspectionLot,
key I_InspectionOperation.InspPlanOperationInternalID,
//Aggregates
// Characteristic
coalesce(P_Inspoperationaggregate2.InspCharOpenCount,0) as InspCharOpenCount,
coalesce(P_Inspoperationaggregate2.InspCharAcceptedCount,0) as InspCharAcceptedCount,
coalesce(P_Inspoperationaggregate2.InspCharRejectedCount,0) as InspCharRejectedCount,
coalesce(P_Inspoperationaggregate2.InspCharLongTermOpenCount,0) as InspCharLongTermOpenCount,
coalesce(P_Inspoperationaggregate2.InspCharShortTermOpenCount,0) as InspCharShortTermOpenCount,
P_Inspoperationaggregate2.InspCharacteristicCount,
coalesce(P_Inspoperationaggregate2.NumberOfSkipInspCharcs,0) as NumberOfSkipInspCharcs,
// Subset Characteristic Aggregates
coalesce( P_InspOperationAggregate4.InspSubsetCharcAcceptedCount, 0 ) as InspSubsetCharcAcceptedCount,
coalesce( P_InspOperationAggregate4.InspSubsetCharcRejectedCount, 0 ) as InspSubsetCharcRejectedCount,
coalesce( P_InspOperationAggregate4.InspSubsetCharcOpenCount, 0 ) as InspSubsetCharcOpenCount,
coalesce( P_InspOperationAggregate4.NumberOfSkipInspSubsetCharcs, 0) as NumberOfSkipInspSubsetCharcs,
// Characteristic aggregates
coalesce(P_Inspoperationaggregate3.InspCharOpenSampleCount,0) as InspCharOpenSampleCount,
coalesce(P_Inspoperationaggregate3.InspCharcAcceptedSampleCount,0) as InspCharcAcceptedSampleCount,
coalesce(P_Inspoperationaggregate3.InspCharRejectedSampleCount,0) as InspCharRejectedSampleCount,
//Counts number of subsets/inspection points which refers to material sample dependent on status
coalesce(P_InspOperationAggregate1.MaterialSampleOpenCount,0) as MaterialSampleOpenCount,
coalesce(P_InspOperationAggregate1.MaterialSampleAcceptedCount,0) as MaterialSampleAcceptedCount,
coalesce(P_InspOperationAggregate1.MaterialSampleRejectedCount,0) as MaterialSampleRejectedCount,
coalesce(P_InspOperationAggregate1.MaterialSampleCount,0) as MaterialSampleCount
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_INSPECTIONOPERATION",
"P_INSPOPERATIONAGGREGATE1",
"P_INSPOPERATIONAGGREGATE2",
"P_INSPOPERATIONAGGREGATE3",
"P_INSPOPERATIONAGGREGATE4"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/