P_InspOperationAggregate4

DDL: P_INSPOPERATIONAGGREGATE4 SQL: PINSPOPAGGR4 Type: view COMPOSITE

P_InspOperationAggregate4 is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_InspSubsetCharacteristic, I_InspectionCharacteristic) and exposes 2 fields with key fields InspectionLot, InspPlanOperationInternalID.

Data Sources (2)

SourceAliasJoin Type
I_InspSubsetCharacteristic I_InspSubsetCharacteristic from
I_InspectionCharacteristic InspChar inner

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PINSPOPAGGR4 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 (2)

KeyFieldSource TableSource FieldDescription
KEY InspectionLot I_InspSubsetCharacteristic InspectionLot
KEY InspPlanOperationInternalID I_InspSubsetCharacteristic InspPlanOperationInternalID
@AbapCatalog.sqlViewName: 'PINSPOPAGGR4'
@AbapCatalog.preserveKey: true
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private:true
@VDM.viewType: #COMPOSITE
define view P_InspOperationAggregate4 as select from I_InspSubsetCharacteristic
       inner join I_InspectionCharacteristic as InspChar
           on InspChar.InspectionLot               = I_InspSubsetCharacteristic.InspectionLot and 
              InspChar.InspPlanOperationInternalID = I_InspSubsetCharacteristic.InspPlanOperationInternalID and
              InspChar.InspectionCharacteristic    = I_InspSubsetCharacteristic.InspectionCharacteristic
   {
    key I_InspSubsetCharacteristic.InspectionLot,
    key I_InspSubsetCharacteristic.InspPlanOperationInternalID,
    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 InspSubsetCharcAcceptedCount,
    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 InspSubsetCharcRejectedCount,
    sum(case 
      when (( I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult is null or 
           I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = ' '  or 
           I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = 'F' )
          and (I_InspSubsetCharacteristic.InspectionCharacteristicStatus <> '4') ) then 1
      when I_InspSubsetCharacteristic._InspSubsetResult.InspectionValuationResult = '+' then 999999 //to force int4-type      

      else 0 end) as InspSubsetCharcOpenCount,
       sum(case when ( (I_InspSubsetCharacteristic.InspectionCharacteristicStatus = '4') and 
       ( I_InspSubsetCharacteristic._InspSubsetResult.InspectionSubsetInternalID is null )  )
     then 1
     else 0 end) as NumberOfSkipInspSubsetCharcs
}
 where not I_InspSubsetCharacteristic.InspectionSubsetInternalID  = '000000'
    group by I_InspSubsetCharacteristic.InspectionLot,
             I_InspSubsetCharacteristic.InspPlanOperationInternalID