@AbapCatalog.sqlViewName: 'CINSPSPECAGR'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Count'
@ObjectModel.usageType: {
dataClass: #MIXED,
sizeCategory: #L,
serviceQuality: #D
}
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
define view C_InspSpecAggregate as select from C_InspLotOpCharcRsltRecg {
// key InspectionLot,
// key InspPlanOperationInternalID,
// key InspectionCharacteristic,
// key MaterialSample,
// InspectionOperation,
// InspSpecLowerLimit,
// InspSpecUpperLimit,
// Inspector,
InspectionSpecification,
InspectionSpecificationPlant,
InspectionSpecificationVersion,
// InspCharcRecgUITemplateID,
// InspectionSpecificationText,
// InspSampleValuationRule,
// InspectionResultMeanValue,
// InspSpecTotalDecimalPlaces,
// InspectionValuationResult,
// CharacteristicAttributeCode,
// CharacteristicAttributeCodeGrp,
// CharcAttributeCodeVers,
// InspSpecRecordingType,
// InspSpecRecgTypeIsSingleRslt,
// InspSpecCharcCategory,
// InspSpecResultCalculation,
// InspSpecIsLongTermInspection,
// InspSpecHasLowerLimit,
// InspSpecHasUpperLimit,
// SelectedCodeSetText,
// InspSpecIsQuantitative,
// UnitOfMeasureTechnicalName,
// InspSpecDecimalPlaces,
// InspSpecHasTargetValue,
// InspSpecTargetValue,
// InspRsltAboveToleranceValsNmbr,
// InspRsltBelowToleranceValsNmbr,
// InspResultValidValuesNumber,
// InspRsltNonconformingValsNmbr,
// InspectionResultStatusText,
// InspectionResultStatus,
// InspectionResultText,
// InspCharcIsNotPlanned,
// InspectionValuationResultText,
// InspSpecIsMeasuredValueRqd,
// ChangedDateTime,
// InspectionSpecificationUnit,
// SelectedCodeSet,
// SelectedCodeSetPlant,
// InspSpecDefectCodeGrpRejection,
// InspSpecDefectCodeRejection,
// InspSpecDefectCodeGrpRjcnLower,
// InspSpecDefectCodeRjcnLower,
// InspSpecDefectCodeGrpRjcnUpper,
// InspSpecDefectCodeRjcnUpper,
// CharacteristicAttributeCatalog,
// InspectionMethod,
// InspectionMethodVersion,
// InspectionMethodText,
// InspectionMethodPlant,
// InspectionMethodIsVisible,
// InspMethodKeyWithText,
// InspCharacteristicSampleSize,
// InspSpecSampleQuantityFactor,
// InspectionCharacteristicStatus,
// InspSpecControlIndicators,
// InspSpecIsSelectedSetRequired,
// InspSpecFormattedSampleText,
// SamplingProcedure,
// BOOCharcSampleQuantity,
// InspCharacteristicSampleUnit,
// QltyCtrlChartAggrgnCriterion,
// InspSpecIsSamplingProcedRqd,
// InspSpecIsControlChartUsed,
// InspSpecIsLowerLimitRequired,
// InspSpecTransferType,
// InspSpecIsUpperLimitRequired,
// InspSpecIsTargetValueInLimit,
// InspSpecIsDefectsRecgAutomatic,
// InspectionSubsetInternalID,
// InspResultVariance,
// InspResultHasVariance,
// InspectionResultAttributeText,
// InspectionResultAttribute,
// InspectionResultOrigin,
// InspectionResultOriginText,
// QualityControlChart,
// CtrlChartHasUpperActionLimit,
// CtrlChartHasLowerActionLimit,
// CtrlChartHasLowerWarningLimit,
// CtrlChartHasUpperWarningLimit,
// ProductionResourceTool,
// ProductionResourceToolDesc,
// InspCharcProdnRsceToolIsAssgd,
// InspLotIsSerialNmbrPossible,
// InspLotHasSubsets,
// SerialNumberProfile,
// BillOfOperationsGroup,
// BillOfOperationsType,
// BillOfOperationsUsage,
// BillOfOperationsVariant,
// InspSpecHasSamplingProcedure,
// InspSpecHasControlChart,
// InspResultIsDocumentationRqd,
// Plant,
// InspectionLotType,
// WorkCenter,
// MatlQualityAuthorizationGroup,
cast( sum ( case when InspectionValuationResult = 'A' then 1 else 0 end ) as abap.int4) as InspCharAcceptedCount,
cast( sum ( case when InspectionValuationResult = 'R' then 1 else 0 end ) as abap.int4) as InspCharRejectedCount ,
cast( sum ( case when ( (InspectionValuationResult is null or InspectionValuationResult = ' ' or InspectionValuationResult = 'F')
and ( InspectionCharacteristicStatus <> '4') ) then 1
when InspectionValuationResult = '+' then 999999
else 0 end ) as abap.int4) as InspCharOpenCount,
cast( sum (case when (InspectionCharacteristicStatus = '4') then 1 else 0 end ) as abap.int4) as NumberOfSkipInspCharcs,
cast( sum ( case when ( InspectionLot is not null and InspPlanOperationInternalID is not null and InspectionCharacteristic is not null and MaterialSample is not null ) then 1 else 0 end ) as abap.int4) as InspCharCount
// /* Associations */
// _CharGroupCode,
// _InspectionMethodVersionText,
// _InspectionResultValue,
// _InspLot,
// _InspLotOp,
// _QualityControlChartTrack,
// _ResultDetails
}
group by InspectionSpecification, InspectionSpecificationPlant, InspectionSpecificationVersion;