P_InspOperationAggregate1

DDL: P_INSPOPERATIONAGGREGATE1 SQL: PINSPOPAGGR1 Type: view COMPOSITE

P_InspOperationAggregate1 is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_InspectionSubset) and exposes 3 fields with key fields InspectionLot, InspPlanOperationInternalID.

Data Sources (1)

SourceAliasJoin Type
I_InspectionSubset I_InspectionSubset from

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PINSPOPAGGR1 view
AbapCatalog.preserveKey true view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE 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 InspPlanOperationInternalID I_InspectionSubset InspPlanOperationInternalID
MaterialSampleCount
@AbapCatalog.sqlViewName: 'PINSPOPAGGR1'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private:true
@VDM.viewType: #COMPOSITE
define view P_InspOperationAggregate1 as select from I_InspectionSubset
{
    key I_InspectionSubset.InspectionLot,
    key I_InspectionSubset.InspPlanOperationInternalID,
    //Counts number of subsets/inspection points which refers to material sample

    sum(case 
     when I_InspectionSubset.InspSubsetUsageDcsnValuation is null or 
          I_InspectionSubset.InspSubsetUsageDcsnValuation = ' '  or 
          I_InspectionSubset.InspSubsetUsageDcsnValuation = 'F'  then 1
     when I_InspectionSubset.InspSubsetUsageDcsnValuation = '+' then 999999 //to force int4-type      

     else 0 end) as MaterialSampleOpenCount,
    sum(case 
     when I_InspectionSubset.InspSubsetUsageDcsnValuation = 'A' then 1 
     when I_InspectionSubset.InspSubsetUsageDcsnValuation = '+' then 999999 //to force int4-type      

     else 0 end) as MaterialSampleAcceptedCount,
    sum(case when I_InspectionSubset.InspSubsetUsageDcsnValuation = 'R' then 1 
     when I_InspectionSubset.InspSubsetUsageDcsnValuation = '+' then 999999 //to force int4-type      

     else 0 end) as MaterialSampleRejectedCount,
    count(*) as MaterialSampleCount   
}
where I_InspectionSubset.MaterialSample is not null or I_InspectionSubset.MaterialSample  != ''
group by I_InspectionSubset.InspectionLot,
         I_InspectionSubset.InspPlanOperationInternalID