I_DEFECT

CDS View

Defect

I_DEFECT is a CDS View in S/4HANA. Defect. It contains 72 fields. 10 CDS views read from this table.

CDS Views using this table (10)

ViewTypeJoinVDMDescription
C_DefectFDP view_entity from CONSUMPTION FDP view for QM Defect
C_DefectOutputParameterFDP view_entity from CONSUMPTION Parameter for Defect (QM) Output
ESH_N_DEFECT view from Anchor view -DEFECT
I_Defect_TP view from TRANSACTIONAL Defect
I_DefectVH view_entity from COMPOSITE Defect
I_InspLotCharcNumberOfDefects view_entity union COMPOSITE Number of Defects for Inspection Charc
I_MfgOrderDefectForSituations view from COMPOSITE Defect list to trigger situation
P_EWM_QltyInspectionEmbedded view_entity from COMPOSITE Quality Inspection for Embedded
P_MfgOrdNrOfDefectSitns view from COMPOSITE Defect situation count per order
R_DefectTP view_entity from TRANSACTIONAL Defect

Fields (72)

KeyField CDS FieldsUsed in Views
KEY DefectInternalID DefectInternalID 3
KEY ProductionOrder ManufacturingOrder,ProductionOrder 4
_CatalogProfile _CatalogProfile 2
_DefectArchivingStatus _DefectArchivingStatus 1
_DefectCategory _DefectCategory 2
_DefectCodeCatalog _DefectCodeCatalog 2
_DefectiveQuantityUnit _DefectiveQuantityUnit 2
_InspectionLot _InspectionLot 3
Batch Batch 3
BOMItemInstanceUUID BOMItemInstanceUUID 2
CatalogProfile CatalogProfile 2
ChangedDateTime ChangedDateTime 3
CostCenter CostCenter 2
CreatedByUser CreatedByUser 3
CreationDate CreationDate 3
CreationTime CreationTime 3
Defect Defect 4
DefectArchivingStatus DefectArchivingStatus 1
DefectCategory DefectCategory 4
DefectCauseCode DefectCauseCode 2
DefectCauseCodeCatalog DefectCauseCodeCatalog 2
DefectCauseCodeGroup DefectCauseCodeGroup 2
DefectCauseCodeVersion DefectCauseCodeVersion 2
DefectCausedBy DefectCausedBy 2
DefectClass DefectClass 3
DefectCode DefectCode 3
DefectCodeCatalog DefectCodeCatalog 3
DefectCodeGroup DefectCodeGroup 3
DefectCodeVersion DefectCodeVersion 2
DefectIsCreatedAutomatically DefectIsCreatedAutomatically 2
DefectiveQuantity DefectiveQuantity 3
DefectiveQuantityUnit DefectiveQuantityUnit 3
DefectiveSingleUnit DefectiveSingleUnit 2
DefectLifecycleStatus DefectLifecycleStatus 2
DefectObjectCode DefectLocationCode,DefectObjectCode 2
DefectObjectCodeCatalog DefectLocationCatalog,DefectObjectCodeCatalog 2
DefectObjectCodeGroup DefectLocationCodeGroup,DefectObjectCodeGroup 2
DefectObjectCodeVersion DefectLocationCodeVersion,DefectObjectCodeVersion 2
DefectOrigin DefectOrigin 3
DefectText DefectText 3
DefectUUID DefectUUID 1
Equipment Equipment 2
EWMWarehouse EWMWarehouse,Warehouse 2
FunctionalLocation FunctionalLocation 2
InspectionCharacteristic InspectionCharacteristic 4
InspectionLot InspectionLot 4
InspectionSubsetInternalID InspectionSubsetInternalID 4
InspPlanOperationInternalID InspPlanOperationInternalID 4
IsDeleted IsDeleted 3
LastChangeDate LastChangeDate 3
LastChangedByUser LastChangedByUser 3
LastChangeTime LastChangeTime 3
MainWorkCenter MainWorkCenter 4
MainWorkCenterInternalID MainWorkCenterInternalID 4
MainWorkCenterPlant MainWorkCenterPlant 4
Material Material,Product 3
MaterialSample MaterialSample 3
NumberOfDefects NumberOfDefects 3
OrderInternalID OrderInternalID 3
Plant Plant 3
ProblemAnalysisStatus ProblemAnalysisStatus 2
ProducedMaterial ProducedMaterial 2
ProducedSerialNumber ProducedSerialNumber 2
ProductionOrderOpActyVers ProductionOrderOpActyVers 2
ProductionOrderOperationActy ProductionOrderOperationActy 2
ProductionSupplyArea ProductionSupplyArea 2
QualityIssueReference QualityIssueReference 2
SourceStorageBin SourceStorageBin 2
SourceStorageType SourceStorageType,StorageType 2
StorageLocation StorageLocation 2
WarehouseLogicalSystem WarehouseLogicalSystem 2
WorkCenterTypeCode WorkCenterTypeCode 4
@EndUserText.label: 'Defect'
@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.privilegedAssociations:  [ '_CreatedByUserContactCard', '_LastChangedByUserContactCard' ]
@AccessControl.personalData.blocking: #BLOCKED_DATA_EXCLUDED
@Analytics.dataCategory: #DIMENSION
@Analytics.technicalName: 'IDEFECT'
@VDM: {
    viewType: #COMPOSITE,
    lifecycle.contract.type: #PUBLIC_LOCAL_API
}
@ObjectModel.supportedCapabilities:
    [ #SQL_DATA_SOURCE, #CDS_MODELING_DATA_SOURCE, #CDS_MODELING_ASSOCIATION_TARGET, #ANALYTICAL_DIMENSION ]
@ObjectModel.modelingPattern: #NONE
@ObjectModel: {
    usageType: {
        dataClass: #TRANSACTIONAL,
        sizeCategory: #L, 
        serviceQuality: #A },
    representativeKey: 'DefectInternalID',
    semanticKey:  [ 'Defect' ]
}
@Metadata.allowExtensions: true
@Metadata.ignorePropagatedAnnotations: true // Projection from generic NotificationItem to Defect => Start new with annotations


define view entity I_Defect as select from I_NotificationItem

    association [0..1] to I_DefectCodeGroup     as _DefectCodeGroup             on  $projection.DefectCodeGroup   = _DefectCodeGroup.DefectCodeGroup
    association [0..1] to I_DefectCode          as _DefectCode                  on  $projection.DefectCodeGroup   = _DefectCode.DefectCodeGroup
                                                                               and $projection.DefectCode        = _DefectCode.DefectCode  

    association [0..1] to I_Inspectioncatalog    as _DefectCauseCodeCatalog    on $projection.DefectCauseCodeCatalog  = _DefectCauseCodeCatalog.InspectionCatalog
    association [0..1] to I_DefectCauseCodeGroup as _DefectCauseCodeGroup      on $projection.DefectCauseCodeGroup    = _DefectCauseCodeGroup.DefectCauseCodeGroup
    association [0..1] to I_DefectCauseCode      as _DefectCauseCode           on $projection.DefectCauseCodeGroup    = _DefectCauseCode.DefectCauseCodeGroup
                                                                              and $projection.DefectCauseCode         = _DefectCauseCode.DefectCauseCode
                                                                               
    association [0..1] to I_Inspectioncatalog   as _DefectObjectCodeCatalog     on  $projection.DefectObjectCodeCatalog      = _DefectObjectCodeCatalog.InspectionCatalog
    association [0..1] to I_InspectionCodeGroup as _DefectObjectPartCodeGroup   on  $projection.DefectObjectCodeCatalog      = _DefectObjectPartCodeGroup.InspectionCatalog
                                                                               and $projection.DefectObjectCodeGroup    = _DefectObjectPartCodeGroup.InspectionCodeGroup
    association [0..1] to I_InspectionCode      as _DefectObjectCode            on  $projection.DefectObjectCodeCatalog      = _DefectObjectCode.InspectionCatalog
                                                                               and $projection.DefectObjectCodeGroup    = _DefectObjectCode.InspectionCodeGroup
                                                                               and $projection.DefectObjectCode             = _DefectObjectCode.InspectionCode                                                                               
   
    association [0..1] to I_DefectStatus            as _DefectStatus           on $projection.DefectLifecycleStatus = _DefectStatus.DefectLifecycleStatus
    association [1..1] to I_DefectArchivingStatus   as _DefectArchivingStatus  on $projection.DefectArchivingStatus = _DefectArchivingStatus.DefectArchivingStatus

    association [0..1] to I_ProblemAnalysisStatus   as _ProblemAnalysisStatus  on $projection.ProblemAnalysisStatus = _ProblemAnalysisStatus.ProblemAnalysisStatus 

    // EWM related

    association [0..1] to I_EWM_WarehouseNumber_2   as _EWM_WarehouseNumber_2  on $projection.EWMWarehouse = _EWM_WarehouseNumber_2.EWMWarehouse
    association [0..1] to I_EWM_StorageType_2       as _EWM_SourceStorageType  on $projection.EWMWarehouse = _EWM_SourceStorageType.EWMWarehouse 
                                                                               and $projection.SourceStorageType = _EWM_SourceStorageType.EWMStorageType
    association [0..1] to I_EWM_StorageBin_2        as _EWM_SourceStorageBin   on $projection.EWMWarehouse = _EWM_SourceStorageBin.EWMWarehouse 
                                                                               and $projection.SourceStorageBin = _EWM_SourceStorageBin.EWMStorageBin
    association [0..1] to I_ProductionSupplyArea    as _ProductionSupplyArea   on $projection.ProductionSupplyArea = _ProductionSupplyArea.ProductionSupplyArea
                                                                               and $projection.Plant = _ProductionSupplyArea.Plant
                                                                                                                                                                                                                                                                                                      
    association [0..1] to I_DefectCausedBy          as _DefectCausedBy         on $projection.DefectCausedBy = _DefectCausedBy.DefectCausedBy
    
    // Inspection Lot related

    association [0..1] to I_InspectionOperation     as _InspectionOperation    on  $projection.InspectionLot = _InspectionOperation.InspectionLot
                                                                               and $projection.InspPlanOperationInternalID = _InspectionOperation.InspPlanOperationInternalID                                                                        
    // Manufacturing Order

    association [0..1] to I_ManufacturingOrder          as _ManufacturingOrder on $projection.ProductionOrder = _ManufacturingOrder.ManufacturingOrder
    association [0..1] to I_ManufacturingOrderOperation as _ManufacturingOrderOperation on  $projection.OrderInternalID = _ManufacturingOrderOperation.MfgOrderInternalID
                                                                                        and $projection.InspPlanOperationInternalID = _ManufacturingOrderOperation.OrderOperationInternalID
     
    //Association to child nodes

    association [0..*] to I_DefectLongText          as _DefectLongText         on $projection.DefectInternalID  = _DefectLongText.DefectInternalID                                                                        
    
    //Extension

    association [1..1] to E_NotificationItem        as _Extension              on  $projection.DefectInternalID = _Extension.Notification and
                                                                                   _Extension.NotificationItem = '0000' 

{
      key cast( I_NotificationItem.Notification as qdefectinternalid preserving type ) as DefectInternalID,
      //  key  I_NotificationItem.NotificationItem,  // Not necessary !? --> No

   
       @ObjectModel.text.element: ['DefectText']
       cast( substring(I_NotificationItem.Notification,2,11) as qdefectid preserving type ) as Defect,

       @ObjectModel: { foreignKey.association: '_DefectCategory' }
       I_NotificationItem.DefectCategory, 
       @ObjectModel: { foreignKey.association: '_CreatedByUserContactCard' }
       I_NotificationItem.CreatedByUser, 
       I_NotificationItem.CreationDate,
       @ObjectModel: { foreignKey.association: '_LastChangedByUserContactCard' }
       I_NotificationItem.LastChangedByUser,
       I_NotificationItem.LastChangeDate,
       @Semantics.text: true
       cast(I_NotificationItem.NotificationItemText as vdm_qfetxt preserving type ) as DefectText,  
       @ObjectModel: { foreignKey.association: '_DefectCodeCatalog' }
       I_NotificationItem.DefectCodeCatalog, 
       @ObjectModel: { foreignKey.association: '_DefectCodeGroup' }
       cast( I_NotificationItem.DefectCodeGroup as vdm_qfegrp preserving type ) as  DefectCodeGroup, 
       @ObjectModel: { foreignKey.association: '_DefectCode' }
       cast( I_NotificationItem.DefectCode      as vdm_qfecod preserving type ) as  DefectCode, 
       I_NotificationItem.DefectCodeVersion,
       @ObjectModel: { foreignKey.association: '_DefectObjectCodeCatalog'}
       cast(I_NotificationItem.NotifItmObjectPartCodeCtlg as vdm_qfeocat preserving type ) as DefectObjectCodeCatalog,
       @ObjectModel: { foreignKey.association: '_DefectObjectPartCodeGroup'}
       cast(I_NotificationItem.NotifItmObjectPartCodeGroup as vdm_qfeogrp preserving type ) as DefectObjectCodeGroup,
       @ObjectModel: { foreignKey.association: '_DefectObjectCode'}
       cast(I_NotificationItem.NotifItmObjectPartCode as vdm_qfeocod preserving type ) as DefectObjectCode,
       I_NotificationItem.NotifItmObjectPartVersion as DefectObjectCodeVersion,       
       
       @ObjectModel: { foreignKey.association: '_DefectCauseCodeCatalog' }
       cast(I_NotificationItem.DefectCauseCodeCatalog as vdm_qinitdefcausecodecat preserving type )   as DefectCauseCodeCatalog,
       @ObjectModel: { foreignKey.association: '_DefectCauseCodeGroup' }
       cast(I_NotificationItem.DefectCauseCodeGroup   as vdm_qinitdefcausecodegroup preserving type ) as DefectCauseCodeGroup,
       @ObjectModel: { foreignKey.association: '_DefectCauseCode' }
       cast(I_NotificationItem.DefectCauseCode        as vdm_qinitdefcausecode preserving type )      as DefectCauseCode,    
       I_NotificationItem.DefectCauseCodeVersion, 
       @Semantics.quantity.unitOfMeasure: 'DefectiveQuantityUnit'
       cast( I_NotificationItem.DefectiveQuantity as vdm_qmgpos preserving type ) as DefectiveQuantity, 
       @ObjectModel.foreignKey.association: '_DefectiveQuantityUnit'
       I_NotificationItem.DefectiveQuantityUnit,
       @Semantics.booleanIndicator: true
       I_NotificationItem.DefectIsCreatedAutomatically, 
       I_NotificationItem.ProductionOrderOperationActy,
       I_NotificationItem.ProductionOrderOpActyVers,
       I_NotificationItem.Batch,
       I_NotificationItem.DefectiveSingleUnit,
       @ObjectModel.foreignKey.association: '_ManufacturingOrder'
       cast( I_NotificationItem.ProductionOrder     as vdm_qm_fertaufnr preserving type )  as ProductionOrder,
       I_NotificationItem.OrderInternalID,       
       
       @Semantics.time: true
       cast( I_NotificationItem.CreationTime        as vdm_qerstezeit preserving type )    as CreationTime, 
       @Semantics.time: true
       cast( I_NotificationItem.LastChangeTime      as vdm_qaendezeit preserving type )    as LastChangeTime,
       @ObjectModel.foreignKey.association: '_DefectClass'
       I_NotificationItem.DefectClass, 
       @DefaultAggregation: #SUM
       I_NotificationItem.NumberOfDefects, 
       I_NotificationItem.InspPlanOperationInternalID,   
       I_NotificationItem.InspectionCharacteristic, 
       I_NotificationItem.InspectionSubsetInternalID,  
       I_NotificationItem.MaterialSample, 

//     Workcenter Data

       I_NotificationItem.WorkCenterTypeCode,  
       I_NotificationItem.MainWorkCenterInternalID,  
       cast( I_NotificationItem.MainWorkCenterPlant as vdm_qarbpwerks preserving type )    as MainWorkCenterPlant,
       @Consumption.valueHelpDefinition: [ { entity: { name: 'I_WrkCtrBySemanticKeyStdVH', element: 'WorkCenter' } } ]
       I_NotificationItem.MainWorkCenter,            //External Id, required for auth. checks


       I_NotificationItem.Equipment,
       I_NotificationItem.FunctionalLocation, 
       @Semantics.booleanIndicator: true
       cast( I_NotificationItem.IsDeleted     as vdm_qdefisdeleted preserving type )  as IsDeleted,
       I_NotificationItem.DefectOrigin, 
       @ObjectModel.foreignKey.association: '_Product'       
       cast( I_NotificationItem.Material as vdm_defective_material preserving type ) as Material,        
       @ObjectModel.foreignKey.association: '_Plant'
       I_NotificationItem.Plant,
       @ObjectModel.foreignKey.association: '_StorageLocation'
       I_NotificationItem.StorageLocation,
       I_NotificationItem.WarehouseLogicalSystem,
       @ObjectModel.foreignKey.association: '_InspectionLot'
       I_NotificationItem.InspectionLot,  
       @ObjectModel.foreignKey.association: '_CatalogProfile'
       I_NotificationItem.CatalogProfile, 
       I_NotificationItem.ChangedDateTime,
       
       @ObjectModel:    {   foreignKey.association: '_DefectStatus'
       }
       DefectLifecycleStatus,
       @ObjectModel:    {   foreignKey.association: '_DefectArchivingStatus'
       }       
       DefectArchivingStatus,
       @ObjectModel:    {   foreignKey.association: '_ProblemAnalysisStatus'
       }
       ProblemAnalysisStatus,
       QualityIssueReference,
       MasterLanguage,
       DefectUUID,
       @ObjectModel.foreignKey.association: '_ProductionSupplyArea'
       ProductionSupplyArea,
       @VDM.lifecycle: { status: #DEPRECATED, successor: 'EWMWarehouse' }
       @API.element: { releaseState: #DEPRECATED, successor: 'EWMWarehouse' }
       EWMWarehouse as Warehouse,
       @ObjectModel.foreignKey.association: '_EWM_WarehouseNumber_2'
       EWMWarehouse,     
       @VDM.lifecycle: { status: #DEPRECATED, successor: 'SourceStorageType' }
       @API.element: { releaseState: #DEPRECATED, successor: 'SourceStorageType' }
       SourceStorageType as StorageType,
       @ObjectModel.foreignKey.association: '_EWM_SourceStorageType'
       SourceStorageType,
       @ObjectModel.foreignKey.association: '_EWM_SourceStorageBin'
       SourceStorageBin,
       @ObjectModel.foreignKey.association: '_DefectCausedBy'
       DefectCausedBy,
       CostCenter,
       BOMItemInstanceUUID,
       ProducedMaterial,
       ProducedSerialNumber,
       
       /* Associations */
       I_NotificationItem._CatalogProfile, 
       I_NotificationItem._DefectCategory, 
       _DefectCode, 
       I_NotificationItem._DefectCodeCatalog, 
       _DefectCodeGroup, 
       I_NotificationItem._InspectionLot, 
//       I_NotificationItem._Notification,  // Do not use, because Defect has no foreignKey relation to I_Notification! 

       I_NotificationItem._DefectiveQuantityUnit,
       _DefectObjectCodeCatalog, 
       _DefectObjectPartCodeGroup, 
       _DefectObjectCode,
       _DefectStatus,
       _DefectArchivingStatus,
       _ProblemAnalysisStatus,
       _Product,
       _ProducedMaterial,
       _Plant,
       _StorageLocation,
       _DefectClass, 
       _CreatedByUserContactCard,
       _LastChangedByUserContactCard, 
       _DefectCauseCodeCatalog,
       _DefectCauseCodeGroup,
       _DefectCauseCode, 
       _DefectLongText,
       _ProductionSupplyArea,
       _EWM_WarehouseNumber_2,
       _EWM_SourceStorageType,
       _EWM_SourceStorageBin,
       _DefectCausedBy,
       _ManufacturingOrder,
       _ManufacturingOrderOperation,
       _InspectionOperation,
       I_NotificationItem._WorkCenter 
} where I_NotificationItem.Notification like '$%'  // ABAP syntax: CP "$*"

    and I_NotificationItem.NotificationItem = '0000'