P_InspMatlSmplCharAggregate

DDL: P_INSPMATLSMPLCHARAGGREGATE SQL: PIMATSMPLCHRAGR Type: view COMPOSITE

P_InspMatlSmplCharAggregate is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_InspectionSubset, I_InspSubsetResult) and exposes 3 fields with key fields InspectionLot, MaterialSample.

Data Sources (2)

SourceAliasJoin Type
I_InspectionSubset I_InspectionSubset from
I_InspSubsetResult I_InspSubsetResult left_outer

Annotations (5)

NameValueLevelField
AbapCatalog.sqlViewName PIMATSMPLCHRAGR view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #COMPOSITE view

Fields (3)

KeyFieldSource TableSource FieldDescription
KEY InspectionLot I_InspectionSubset InspectionLot
KEY MaterialSample I_InspectionSubset MaterialSample
InspCharacteristicCount
@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":""
}
}*/