@AbapCatalog.sqlViewName : 'PIMATSMPLCHRAGR'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private:true
@VDM.viewType: #COMPOSITE
define view P_InspMatlSmplCharAggregate as select from I_InspectionSubset
left outer join ( I_InspSubsetCharacteristic
left outer join I_InspSubsetResult on I_InspSubsetResult.InspectionLot = I_InspSubsetCharacteristic.InspectionLot and
I_InspSubsetResult.InspPlanOperationInternalID = I_InspSubsetCharacteristic.InspPlanOperationInternalID and
I_InspSubsetResult.InspectionCharacteristic = I_InspSubsetCharacteristic.InspectionCharacteristic and
I_InspSubsetResult.InspectionSubsetInternalID = I_InspSubsetCharacteristic.InspectionSubsetInternalID )
on I_InspSubsetCharacteristic.InspectionLot = I_InspectionSubset.InspectionLot and
I_InspSubsetCharacteristic.InspPlanOperationInternalID = I_InspectionSubset.InspPlanOperationInternalID and
I_InspSubsetCharacteristic.InspectionSubsetInternalID = I_InspectionSubset.InspectionSubsetInternalID
{
key I_InspectionSubset.InspectionLot,
key I_InspectionSubset.MaterialSample,
sum(case
when I_InspSubsetResult.InspectionValuationResult = 'A' then 1
when I_InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type
else 0 end ) as InspCharAcceptedCount,
sum(case when I_InspSubsetResult.InspectionValuationResult = 'R' then 1
when I_InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type
else 0 end ) as InspCharRejectedCount,
count( distinct I_InspSubsetCharacteristic.InspectionCharacteristic) as InspCharacteristicCount,
sum(case
when I_InspSubsetResult.InspectionValuationResult is null or
I_InspSubsetResult.InspectionValuationResult = ' ' or
I_InspSubsetResult.InspectionValuationResult = 'F' then 1
when I_InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type
else 0 end ) as InspCharOpenCount ,
sum(case when ( ( I_InspSubsetCharacteristic.InspectionCharacteristicStatus = '4' ) and ( I_InspSubsetResult.InspectionCharacteristic is null ) )
then 1
else 0 end ) as NumberOfSkipInspCharcs
}
where I_InspectionSubset.MaterialSample is not null and I_InspectionSubset.MaterialSample <> ''
group by I_InspectionSubset.InspectionLot, I_InspectionSubset.MaterialSample
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"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
P_InspMatlSmplCharAggregate view