@AbapCatalog.sqlViewName : 'IINSPOPMSMLAGGR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label : 'Aggregation on insp op mat sample level'
@VDM.viewType: #COMPOSITE
@ObjectModel.usageType: { dataClass: #MIXED, sizeCategory: #L, serviceQuality: #D }
define view I_InspOperMatlSampleAggregate
as select from I_InspectionOperation
inner join I_InspectionSubset on I_InspectionSubset.InspectionLot = I_InspectionOperation.InspectionLot
and I_InspectionSubset.InspPlanOperationInternalID = I_InspectionOperation.InspPlanOperationInternalID
inner join I_InspSubsetCharacteristic on I_InspSubsetCharacteristic.InspectionLot = I_InspectionSubset.InspectionLot
and I_InspSubsetCharacteristic.InspPlanOperationInternalID = I_InspectionSubset.InspPlanOperationInternalID
and I_InspSubsetCharacteristic.InspectionSubsetInternalID = I_InspectionSubset.InspectionSubsetInternalID
{
key I_InspectionOperation.InspectionLot,
key I_InspectionOperation.InspPlanOperationInternalID,
key I_InspectionOperation.InspectionOperation,
key I_InspectionSubset.MaterialSample,
sum(case when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult is null
or I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = ' ' then 1
when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type
else 0 end ) as InspCharOpenSampleCount,
sum(case when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = 'A' then 1
when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type
else 0 end ) as InspCharcAcceptedSampleCount,
sum(case when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = 'R' then 1
when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type
else 0 end ) as InspCharRejectedSampleCount
}
group by
I_InspectionOperation.InspectionLot,
I_InspectionOperation.InspPlanOperationInternalID,
I_InspectionOperation.InspectionOperation,
I_InspectionSubset.MaterialSample
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_INSPECTIONOPERATION",
"I_INSPECTIONSUBSET",
"I_INSPSUBSETCHARACTERISTIC",
"I_INSPSUBSETRESULT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
I_InspOperMatlSampleAggregate view