C_DefectRecord

DDL: C_DEFECTRECORD SQL: CDEFREC Type: view CONSUMPTION Package: ODATA_QM_DEFECT

Record Defect

C_DefectRecord is a Consumption CDS View that provides data about "Record Defect" in SAP S/4HANA. It reads from 1 data source (I_Defect_TP) and exposes 110 fields with key field DefectInternalID. It has 20 associations to related views. Part of development package ODATA_QM_DEFECT.

Data Sources (1)

SourceAliasJoin Type
I_Defect_TP _Defect from

Associations (20)

CardinalityTargetAliasCondition
[0..1] C_DefectLongText _DefectLongTextTP $projection.DefectInternalID = _DefectLongTextTP.DefectInternalID with default filter _DefectLongTextTP.Language = _DefectLongTextTP.MasterLanguage and _DefectLongTextTP.ItemCounter = 1
[0..*] C_DefectRecordAffectedObject _DefectAffectedObjectTP $projection.DefectInternalID = _DefectAffectedObjectTP.DefectInternalID
[0..*] C_DefectTaskRecord _DefectTaskRecord $projection.DefectInternalID = _DefectTaskRecord.DefectInternalID
[0..1] C_DefectProbSolvingProcInfo _DefectProbSolvingProcInfo $projection.DefectInternalID = _DefectProbSolvingProcInfo.DefectInternalID
[0..*] I_DefectStatusText _DefectStatusText $projection.DefectLifecycleStatus = _DefectStatusText.DefectLifecycleStatus
[1..1] C_MfgExecDefectRecord _MfgExecDefectRecord $projection.DefectInternalID = _MfgExecDefectRecord.DefectInternalID
[0..1] C_DefectMngCharcs _DefectInspCharacteristic $projection.InspectionLot = _DefectInspCharacteristic.InspectionLot and $projection.InspPlanOperationInternalID = _DefectInspCharacteristic.InspPlanOperationInternalID and $projection.InspectionCharacteristic = _DefectInspCharacteristic.InspectionCharacteristic
[0..1] C_DefectMngCharacteristicsSbst _DefectInspSubsCharacteristic $projection.InspectionLot = _DefectInspSubsCharacteristic.InspectionLot and $projection.InspPlanOperationInternalID = _DefectInspSubsCharacteristic.InspPlanOperationInternalID and $projection.InspectionSubsetInternalID = _DefectInspSubsCharacteristic.InspectionSubsetInternalID and $projection.MaterialSample = _DefectInspSubsCharacteristic.MaterialSample and $projection.InspectionCharacteristic = _DefectInspSubsCharacteristic.InspectionCharacteristic
[0..1] I_InspectionOperation _InspectionOperation $projection.InspectionLot = _InspectionOperation.InspectionLot and $projection.InspPlanOperationInternalID = _InspectionOperation.InspPlanOperationInternalID
[0..1] I_ProductionOrderStdVH _ProductionOrderStdVH $projection.ProductionOrder = _ProductionOrderStdVH.ProductionOrder
[0..1] I_MfgOrderVH _MfgOrderVH $projection.ProductionOrder = _MfgOrderVH.ManufacturingOrder
[0..1] I_ProdnOrdOpBySemKeyStdVH _ProdnOrdOpBySemKeyStdVH $projection.ProductionOrder = _ProdnOrdOpBySemKeyStdVH.ProductionOrder and $projection.ProductionOrderSequence = _ProdnOrdOpBySemKeyStdVH.ProductionOrderSequence and $projection.ProductionOrderOperation = _ProdnOrdOpBySemKeyStdVH.ProductionOrderOperation
[0..1] I_MfgOrdOpBySemanticKeyStdVH _MfgOrdOpBySemanticKeyStdVH $projection.ProductionOrder = _MfgOrdOpBySemanticKeyStdVH.ManufacturingOrder and $projection.ProductionOrderSequence = _MfgOrdOpBySemanticKeyStdVH.ManufacturingOrderSequence and $projection.ProductionOrderOperation = _MfgOrdOpBySemanticKeyStdVH.ManufacturingOrderOperation
[0..1] I_WrkCtrBySemanticKeyStdVH _MainWorkCenterStdVH $projection.MainWorkCenter = _MainWorkCenterStdVH.WorkCenter and $projection.MainWorkCenterPlant = _MainWorkCenterStdVH.Plant
[0..1] I_PlantStdVH _MainWorkCenterPlantStdVH $projection.MainWorkCenterPlant = _MainWorkCenterPlantStdVH.Plant
[0..1] I_DefectLocationCatalog _DefectLocationCatalog $projection.DefectLocationCatalog = _DefectLocationCatalog.DefectLocationCatalog
[0..1] I_DefectLocationCodeGroup _DefectLocationCodeGroup $projection.DefectLocationCatalog = _DefectLocationCodeGroup.DefectLocationCatalog and $projection.DefectLocationCodeGroup = _DefectLocationCodeGroup.DefectLocationCodeGroup
[0..1] I_DefectLocationCode _DefectLocationCode $projection.DefectLocationCatalog = _DefectLocationCode.DefectLocationCatalog and $projection.DefectLocationCodeGroup = _DefectLocationCode.DefectLocationCodeGroup and $projection.DefectLocationCode = _DefectLocationCode.DefectLocationCode
[0..1] I_MfgOrderTypeVH _MfgOrderTypeVH $projection.ManufacturingOrderType = _MfgOrderTypeVH.ManufacturingOrderType
[0..1] I_QualityNotificationItem _RelatedNotificationItem $projection.DefectInternalID = _RelatedNotificationItem.ReferencedDefect and _RelatedNotificationItem.IsDeleted = ''

Annotations (24)

NameValueLevelField
AbapCatalog.sqlViewName CDEFREC view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #MANDATORY view
AccessControl.personalData.blocking #BLOCKED_DATA_EXCLUDED view
EndUserText.label Record Defect view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.representativeKey DefectInternalID view
ObjectModel.compositionRoot true view
ObjectModel.transactionalProcessingDelegated true view
ObjectModel.draftEnabled true view
ObjectModel.createEnabled true view
ObjectModel.updateEnabled EXTERNAL_CALCULATION view
ObjectModel.deleteEnabled true view
Metadata.allowExtensions true view
UI.headerInfo.typeName Defect view
UI.headerInfo.typeNamePlural Defects view
UI.headerInfo.title.value Defect view
UI.headerInfo.title.label Defect view
UI.headerInfo.description.value DefectText view
Consumption.semanticObject Defect view

Fields (110)

KeyFieldSource TableSource FieldDescription
KEY DefectInternalID I_Defect_TP DefectInternalID
Defect I_Defect_TP Defect
DefectCategory I_Defect_TP DefectCategory
DefectCategoryText
DefectCodeCatalog I_Defect_TP DefectCodeCatalog
DefectCodeGroup I_Defect_TP DefectCodeGroup
DefectCodeGroupText
DefectCode I_Defect_TP DefectCode
DefectCodeText
QualityIssueReference I_Defect_TP QualityIssueReference
DefectText I_Defect_TP DefectText
DefectLifecycleStatus I_Defect_TP DefectLifecycleStatus
DefectLifecycleStatusText
IsDeleted I_Defect_TP IsDeleted
QualityNotification _RelatedNotificationItem QualityNotification
NotificationItemExternalID _RelatedNotificationItem NotificationItemExternalID
ProblemAnalysisStatus I_Defect_TP ProblemAnalysisStatus
MasterLanguage I_Defect_TP MasterLanguage
DefectiveQuantity I_Defect_TP DefectiveQuantity
DefectiveQuantityUnit I_Defect_TP DefectiveQuantityUnit
Plant I_Defect_TP Plant
PlantName
Material I_Defect_TP Material
ProductName
Batch I_Defect_TP Batch
StorageLocation I_Defect_TP StorageLocation
StorageLocationName _StorageLocation StorageLocationName
NumberOfDefects I_Defect_TP NumberOfDefects
CreationDate I_Defect_TP CreationDate
CreationTime I_Defect_TP CreationTime
CreationDateTime
CreatedByUser I_Defect_TP CreatedByUser
CreatedByUserFullName
LastChangeDate I_Defect_TP LastChangeDate
LastChangeTime I_Defect_TP LastChangeTime
LastChangeDateTime
LastChangedByUser I_Defect_TP LastChangedByUser
LastChangedByUserFullName
InspectionLot I_Defect_TP InspectionLot
InspPlanOperationInternalID I_Defect_TP InspPlanOperationInternalID
InspectionCharacteristic I_Defect_TP InspectionCharacteristic
InspectionSubsetInternalID I_Defect_TP InspectionSubsetInternalID
MaterialSample I_Defect_TP MaterialSample
DefectClass I_Defect_TP DefectClass
ProductionOrder
ManufacturingOrderCategory _MfgOrderVH ManufacturingOrderCategory
ManufacturingOrderCategoryName
ManufacturingOrderType
DefectOrderSemanticObject
DefectOrderSemObjKeyProperty
ProductionOrderSequence
MfgOrderSequenceText
ProductionOrderOperation
MainWorkCenter I_Defect_TP MainWorkCenter
MainWorkCenterPlant I_Defect_TP MainWorkCenterPlant
WorkCenterTypeCode I_Defect_TP WorkCenterTypeCode
MainWorkCenterInternalID I_Defect_TP MainWorkCenterInternalID
DefectConfigurationValue I_Defect_TP DefectConfigurationValue
ProductionSupplyArea I_Defect_TP ProductionSupplyArea
ProductionSupplyAreaName
Warehouse I_Defect_TP Warehouse
EWMWarehouseDescription
StorageType I_Defect_TP StorageType
EWMStorageTypeName
SourceStorageBin I_Defect_TP SourceStorageBin
WarehouseLogicalSystem I_Defect_TP WarehouseLogicalSystem
DefectCausedBy I_Defect_TP DefectCausedBy
CostCenter I_Defect_TP CostCenter
DefectLocationCatalog I_Defect_TP DefectObjectCodeCatalog
DefectLocationCatalogText
DefectLocationCodeGroup I_Defect_TP DefectObjectCodeGroup
DefectLocationCodeGroupText
DefectLocationCode I_Defect_TP DefectObjectCode
DefectLocationCodeText
_DefectCodeGroup _DefectCodeGroup
_DefectCode _DefectCode
_DefectCategory _DefectCategory
_DefectStatus _DefectStatus
_DefectStatusText _DefectStatusText
_DefectiveQtyUnitOfMeasure _DefectiveQtyUnitOfMeasure
_DefectiveQuantityUnit _DefectiveQuantityUnit
_ProblemAnalysisStatus _ProblemAnalysisStatus
_Product _Product
_Plant _Plant
_StorageLocation _StorageLocation
_DefectClass _DefectClass
_DefectLongTextTP _DefectLongTextTP
_DefectAffectedObjectTP _DefectAffectedObjectTP
_DefectTaskRecord _DefectTaskRecord
_MfgExecDefectRecord _MfgExecDefectRecord
_DefectInspCharacteristic _DefectInspCharacteristic
_DefectInspSubsCharacteristic _DefectInspSubsCharacteristic
_InspectionOperation _InspectionOperation
_CreatedByUserContactCard _CreatedByUserContactCard
_LastChangedByUserContactCard _LastChangedByUserContactCard
_ProductionOrderStdVH _ProductionOrderStdVH
_MfgOrderVH _MfgOrderVH
_ProdnOrdOpBySemKeyStdVH _ProdnOrdOpBySemKeyStdVH
_MfgOrdOpBySemanticKeyStdVH _MfgOrdOpBySemanticKeyStdVH
_MainWorkCenterStdVH _MainWorkCenterStdVH
_MainWorkCenterPlantStdVH _MainWorkCenterPlantStdVH
_InspectionLot _InspectionLot
_DefectProbSolvingProcInfo _DefectProbSolvingProcInfo
ProbSolvingProc _DefectProbSolvingProcInfo ProbSolvingProc
_ProductionSupplyArea _ProductionSupplyArea
_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2
_EWM_SourceStorageType _EWM_SourceStorageType
_EWM_SourceStorageBin _EWM_SourceStorageBin
_DefectCausedBy _DefectCausedBy
_MfgOrderTypeVH _MfgOrderTypeVH
@AbapCatalog.sqlViewName: 'CDEFREC'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl: {
    authorizationCheck: #MANDATORY,
    personalData.blocking: #BLOCKED_DATA_EXCLUDED,
    privilegedAssociations:  [ '_CreatedByUserContactCard', '_LastChangedByUserContactCard' ]
}
@EndUserText.label: 'Record Defect'
@VDM.viewType: #CONSUMPTION

@ObjectModel: {
    usageType: {
        dataClass: #TRANSACTIONAL,
        sizeCategory: #XL,
        serviceQuality: #C },
    representativeKey: 'DefectInternalID',
    semanticKey:  [ 'Defect' ],
// Begin Draft 2.0

    compositionRoot: true,
    transactionalProcessingDelegated:true,
    draftEnabled:  true,
    createEnabled: true,
    updateEnabled: 'EXTERNAL_CALCULATION',
    deleteEnabled: true
}

@Metadata.allowExtensions: true

@UI.headerInfo: {
    typeName: 'Defect',
    typeNamePlural: 'Defects',
    title: {value: 'Defect', label: 'Defect'},
    description: {value: 'DefectText'}
}
@Consumption.semanticObject: 'Defect'

@UI.presentationVariant.requestAtLeast:
    ['InspectionSubsetInternalID', '_DefectLongTextTP.DefectLongText',
     'DefectOrderSemanticObject', 'DefectOrderSemObjKeyProperty'
    ]
define view C_DefectRecord
  as select from I_Defect_TP as _Defect

  //Association to child nodes

  association [0..1] to C_DefectLongText               as _DefectLongTextTP             on  $projection.DefectInternalID = _DefectLongTextTP.DefectInternalID
  with default filter _DefectLongTextTP.Language    = _DefectLongTextTP.MasterLanguage
               and    _DefectLongTextTP.ItemCounter = 1
  association [0..*] to C_DefectRecordAffectedObject   as _DefectAffectedObjectTP       on  $projection.DefectInternalID = _DefectAffectedObjectTP.DefectInternalID


  association [0..*] to C_DefectTaskRecord             as _DefectTaskRecord             on  $projection.DefectInternalID = _DefectTaskRecord.DefectInternalID

  association [0..1] to C_DefectProbSolvingProcInfo    as _DefectProbSolvingProcInfo    on  $projection.DefectInternalID = _DefectProbSolvingProcInfo.DefectInternalID

  //Work-around for issue with update of DefectLifecycleStatusText

  association [0..*] to I_DefectStatusText             as _DefectStatusText             on  $projection.DefectLifecycleStatus = _DefectStatusText.DefectLifecycleStatus

  //Assiciation to MPE view

  association [1..1] to C_MfgExecDefectRecord          as _MfgExecDefectRecord          on  $projection.DefectInternalID = _MfgExecDefectRecord.DefectInternalID

  //Association to views specific to defects from automatic defects recording (reuse of views originally built for 'Manage Defects' app

  association [0..1] to C_DefectMngCharcs              as _DefectInspCharacteristic     on  $projection.InspectionLot               = _DefectInspCharacteristic.InspectionLot
                                                                                        and $projection.InspPlanOperationInternalID = _DefectInspCharacteristic.InspPlanOperationInternalID
                                                                                        and $projection.InspectionCharacteristic    = _DefectInspCharacteristic.InspectionCharacteristic

  association [0..1] to C_DefectMngCharacteristicsSbst as _DefectInspSubsCharacteristic on  $projection.InspectionLot               = _DefectInspSubsCharacteristic.InspectionLot
                                                                                        and $projection.InspPlanOperationInternalID = _DefectInspSubsCharacteristic.InspPlanOperationInternalID
                                                                                        and $projection.InspectionSubsetInternalID  = _DefectInspSubsCharacteristic.InspectionSubsetInternalID
                                                                                        and $projection.MaterialSample              = _DefectInspSubsCharacteristic.MaterialSample
                                                                                        and $projection.InspectionCharacteristic    = _DefectInspSubsCharacteristic.InspectionCharacteristic

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

  //                                                                                    $projection.InspectionSubsetInternalID = _DefectInspectionSubset.InspectionSubsetInternalID and

  //                                                                                    $projection.InspPlanOperationInternalID = _DefectInspectionSubset.InspPlanOperationInternalID


  //Value Help and Text Provider for Production Order Data related fields

  association [0..1] to I_ProductionOrderStdVH         as _ProductionOrderStdVH         on  $projection.ProductionOrder = _ProductionOrderStdVH.ProductionOrder
  association [0..1] to I_MfgOrderVH                   as _MfgOrderVH                   on  $projection.ProductionOrder = _MfgOrderVH.ManufacturingOrder

  //    association [0..1] to I_MfgOrderSequenceBasic      as _ProductionOrderSequence    on  $projection.ProductionOrder = _ProductionOrderSequence.ManufacturingOrder

  //                                                                                      and $projection.ProductionOrderSequence = _ProductionOrderSequence.ManufacturingOrderSequence


  association [0..1] to I_ProdnOrdOpBySemKeyStdVH      as _ProdnOrdOpBySemKeyStdVH      on  $projection.ProductionOrder          = _ProdnOrdOpBySemKeyStdVH.ProductionOrder
                                                                                        and $projection.ProductionOrderSequence  = _ProdnOrdOpBySemKeyStdVH.ProductionOrderSequence
                                                                                        and $projection.ProductionOrderOperation = _ProdnOrdOpBySemKeyStdVH.ProductionOrderOperation
  association [0..1] to I_MfgOrdOpBySemanticKeyStdVH   as _MfgOrdOpBySemanticKeyStdVH   on  $projection.ProductionOrder          = _MfgOrdOpBySemanticKeyStdVH.ManufacturingOrder
                                                                                        and $projection.ProductionOrderSequence  = _MfgOrdOpBySemanticKeyStdVH.ManufacturingOrderSequence
                                                                                        and $projection.ProductionOrderOperation = _MfgOrdOpBySemanticKeyStdVH.ManufacturingOrderOperation

  association [0..1] to I_WrkCtrBySemanticKeyStdVH     as _MainWorkCenterStdVH          on  $projection.MainWorkCenter      = _MainWorkCenterStdVH.WorkCenter
                                                                                        and $projection.MainWorkCenterPlant = _MainWorkCenterStdVH.Plant
  association [0..1] to I_PlantStdVH                   as _MainWorkCenterPlantStdVH     on  $projection.MainWorkCenterPlant = _MainWorkCenterPlantStdVH.Plant


  association [0..1] to I_DefectLocationCatalog        as _DefectLocationCatalog        on  $projection.DefectLocationCatalog = _DefectLocationCatalog.DefectLocationCatalog

  association [0..1] to I_DefectLocationCodeGroup      as _DefectLocationCodeGroup      on  $projection.DefectLocationCatalog   = _DefectLocationCodeGroup.DefectLocationCatalog
                                                                                        and $projection.DefectLocationCodeGroup = _DefectLocationCodeGroup.DefectLocationCodeGroup

  association [0..1] to I_DefectLocationCode           as _DefectLocationCode           on  $projection.DefectLocationCatalog   = _DefectLocationCode.DefectLocationCatalog
                                                                                        and $projection.DefectLocationCodeGroup = _DefectLocationCode.DefectLocationCodeGroup
                                                                                        and $projection.DefectLocationCode      = _DefectLocationCode.DefectLocationCode

  association [0..1] to I_MfgOrderTypeVH               as _MfgOrderTypeVH               on  $projection.ManufacturingOrderType = _MfgOrderTypeVH.ManufacturingOrderType

  //=== Association to related Notification Item

  /*+[hideWarning] { "IDS" : [ "CARDINALITY_CHECK" ] } */
  association [0..1] to I_QualityNotificationItem      as _RelatedNotificationItem      on  $projection.DefectInternalID       = _RelatedNotificationItem.ReferencedDefect
                                                                                        and _RelatedNotificationItem.IsDeleted = ''
{
  key _Defect.DefectInternalID,

      @ObjectModel:{  readOnly,
                      text.element:  [ 'DefectText' ]
      }
      _Defect.Defect,

      @ObjectModel.readOnly: 'EXTERNAL_CALCULATION'
      @ObjectModel.text.element: ['DefectCategoryText']
      @Consumption.valueHelpDefinition: [
        { entity:  { name:    'C_DefectCatVH',
                     element: 'DefectCategory' }
        }]
      _Defect.DefectCategory,
      @ObjectModel.readOnly: true
      _Defect._DefectCategory._Text[1: Language = $session.system_language ].DefectCategoryText,

      @ObjectModel.readOnly
      @ObjectModel.foreignKey.association: [ { exclude } ]
      @Consumption.filter.hidden: true
      _Defect.DefectCodeCatalog,

      @ObjectModel.text.element: ['DefectCodeGroupText']

      @Consumption.valueHelpDefinition: [
        { entity:  { name:    'C_DefectRuleBasedCodeGroupVH',
                     element: 'DefectCodeGroup' },
                     additionalBinding: [  { localElement: 'InspectionLot',               element: 'InspectionLot', usage: #FILTER },
                                           { localElement: 'InspPlanOperationInternalID', element: 'InspPlanOperationInternalID', usage: #FILTER },
                                           { localElement: 'InspectionCharacteristic',    element: 'InspectionCharacteristic', usage: #FILTER },
                                           { localElement: 'Material',                    element: 'Material', usage: #FILTER },
                                           { localElement: 'Plant',                       element: 'Plant', usage: #FILTER },
                                           { localElement: 'MainWorkCenter',              element: 'WorkCenter', usage: #FILTER },
                                           { localElement: 'DefectCategory',              element: 'DefectCategory', usage: #FILTER },
                                           { localElement: 'DefectInternalID',            element: 'DefectInternalID', usage: #FILTER }
                                        ]
        }]
      _Defect.DefectCodeGroup,
      @ObjectModel.readOnly: true
      _Defect._DefectCodeGroup._Text[1: Language = $session.system_language ].DefectCodeGroupText,

      @ObjectModel.text.element: ['DefectCodeText']

      @Consumption.valueHelpDefinition: [
        { entity:  { name:    'C_DefectRuleBasedCodeVH',
                     element: 'DefectCode' },
                     additionalBinding: [  { localElement: 'DefectCodeGroup',             element: 'DefectCodeGroup' },
                                           { localElement: 'InspectionLot',               element: 'InspectionLot', usage: #FILTER },
                                           { localElement: 'InspPlanOperationInternalID', element: 'InspPlanOperationInternalID', usage: #FILTER },
                                           { localElement: 'InspectionCharacteristic',    element: 'InspectionCharacteristic', usage: #FILTER },
                                           { localElement: 'Material',                    element: 'Material', usage: #FILTER },
                                           { localElement: 'Plant',                       element: 'Plant', usage: #FILTER },
                                           { localElement: 'MainWorkCenter',              element: 'WorkCenter', usage: #FILTER },
                                           { localElement: 'DefectCategory',              element: 'DefectCategory', usage: #FILTER },
                                           { localElement: 'DefectInternalID',            element: 'DefectInternalID', usage: #FILTER }
                                        ]
         }]
      _Defect.DefectCode,
      @ObjectModel.readOnly: true
      _Defect._DefectCode._Text[1: Language = $session.system_language ].DefectCodeText,

      _Defect.QualityIssueReference,

      @ObjectModel.mandatory: 'EXTERNAL_CALCULATION'
      @Semantics.text: true
      _Defect.DefectText,

      @ObjectModel: {     readOnly: true,
                          text.element: ['DefectLifecycleStatusText']
      }
      @Consumption.valueHelpDefinition: [
          { entity:  { name:    'I_DefectStatus',
                       element: 'DefectLifecycleStatus' },
            additionalBinding: [{ localElement: 'DefectLifecycleStatus',
                                  element: 'DefectLifecycleStatus' }]
          }]
      _Defect.DefectLifecycleStatus,
      @ObjectModel.readOnly: true
      _Defect._DefectStatus._DefectStatusText[1: Language = $session.system_language ].DefectLifecycleStatusText,

      @Semantics.booleanIndicator: true
      @Consumption.filter.hidden: true
      _Defect.IsDeleted,

      @ObjectModel.readOnly: true
      @ObjectModel.foreignKey.association: [ { exclude } ]
      @Consumption.filter.hidden: true
      @Consumption.semanticObject: 'QualityNotification'
      _RelatedNotificationItem.QualityNotification,

      @ObjectModel.readOnly: true
      @Consumption.filter.hidden: true
      _RelatedNotificationItem.NotificationItemExternalID,

      @ObjectModel.readOnly: true
      _Defect.ProblemAnalysisStatus,

      @ObjectModel.readOnly: true
      _Defect.MasterLanguage,

      @Consumption.filter.hidden: true
      _Defect.DefectiveQuantity,
      @ObjectModel.foreignKey.association: '_DefectiveQtyUnitOfMeasure'  // Keep deprecated association, as soon as the odata/sadl/fiori consumers can handle the successor

      @Consumption: {
          filter.hidden: true,
          valueHelpDefinition: [
                            { entity:  { name:    'I_ProductUnitsOfMeasureVH', element: 'AlternativeUnit' },
                              additionalBinding: [{ localElement: 'Material', element: 'Product' }]
                            },
                            { entity:  { name:    'I_UnitOfMeasureStdVH', element: 'UnitOfMeasure' },
                              qualifier: 'vh_uom_stdvh'
                            }
          ]
      }
      _Defect.DefectiveQuantityUnit,

      @ObjectModel.text.element: ['PlantName']
      @Consumption: {
          valueHelpDefinition: [
              { entity:  {    name:    'I_PlantStdVH',
                              element: 'Plant' }
              }
          ],
          semanticObject: 'Plant'
      }
      _Defect.Plant,
      @ObjectModel.readOnly: true
      _Defect._Plant.PlantName,

      @ObjectModel.text.element: ['ProductName']
      @Consumption: {
          valueHelpDefinition: [
              { entity:  {    name:    'I_ProductVH',
                              element: 'Product' }
              },
              { entity:  {    name:    'I_ProductPlantVH',
                              element: 'Product' },
                qualifier: 'vh_productplant_vh',
                additionalBinding: [{ localElement: 'Plant', element: 'Plant', usage: #FILTER }]
              }
          ],
          semanticObject: 'Material'
      }
      _Defect.Material,
      @ObjectModel.readOnly: true
      _Defect._Product._Text[1: Language = $session.system_language ].ProductName,

      @Consumption: {
          semanticObject: 'Batch',
          semanticObjectMapping.additionalBinding: [
            { element: 'Plant', localElement: 'Plant' }, { element: 'Material', localElement: 'Material' }, { element: 'Batch', localElement: 'Batch' }
          ],
          valueHelpDefinition: [
          {   entity: { name: 'I_BatchVH', element: 'Batch' },
              additionalBinding: [{ element: 'Plant', localElement: 'Plant' }, { element: 'Material', localElement: 'Material' }]
          }]
      }
      _Defect.Batch,

      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      @ObjectModel.text.element: [ 'StorageLocationName' ]
      @Consumption: {
          semanticObject: 'StorageLocation',
          valueHelpDefinition: [
          {   entity: { name: 'I_StorageLocationStdVH', element: 'StorageLocation' },
              additionalBinding: [{ element: 'Plant', localElement: 'Plant' }]
          }]
      }
      _Defect.StorageLocation,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _StorageLocation.StorageLocationName,

      @Consumption.filter.hidden: true
      _Defect.NumberOfDefects,

      @Consumption.hidden: true
      _Defect.CreationDate,
      @Consumption.hidden: true
      _Defect.CreationTime,
      @ObjectModel.readOnly: true
      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      @ObjectModel.filter: { enabled: true, transformedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT' }
      @ObjectModel.sort:   { enabled: true, transformedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT' }
      @Consumption.filter: { selectionType: #INTERVAL }
      @EndUserText: { label: 'Created On', quickInfo: 'Record Created On' }
      cast( 0 as timestamp )                                                                                   as CreationDateTime,
      @ObjectModel.foreignKey.association: [ { exclude } ]
      @ObjectModel: {
                text.element: [ 'CreatedByUserFullName' ]}
      @UI.textArrangement: #TEXT_ONLY
      @Consumption.valueHelpDefinition: [
          { entity: { name: 'I_DefectUserVH', element: 'UserID' } }
        ]
      _Defect.CreatedByUser,
      @Semantics.text: true
      @ObjectModel.readOnly: true
      cast( _Defect._CreatedByUserContactCard.FullName as vdm_qm_createdbyuserdesc preserving type )       as CreatedByUserFullName,

      @Consumption.hidden: true
      _Defect.LastChangeDate,
      @Consumption.hidden: true
      _Defect.LastChangeTime,
      @ObjectModel.readOnly: true
      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      @ObjectModel.filter: { enabled: true, transformedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT' }
      @ObjectModel.sort:   { enabled: true, transformedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT' }
      @Consumption.filter: { selectionType: #INTERVAL }
      @EndUserText: { label: 'Changed On', quickInfo: 'Record Last Changed On' }
      cast( 0 as timestamp )                                                                                   as LastChangeDateTime,
      @ObjectModel.foreignKey.association: [ { exclude } ]
      @ObjectModel: {
               text.element: [ 'LastChangedByUserFullName' ]}
      @UI.textArrangement: #TEXT_ONLY
      @Consumption.valueHelpDefinition: [
          { entity: { name: 'I_DefectUserVH', element: 'UserID' } }
        ]
      _Defect.LastChangedByUser,
      @Semantics.text: true
      @ObjectModel.readOnly: true
      cast( _Defect._LastChangedByUserContactCard.FullName as vdm_qm_lastchangedbyuserdesc preserving type ) as LastChangedByUserFullName,

      @Consumption.valueHelpDefinition: [
      { entity:  { name:    'I_InspectionLotStd1VH',
                  element: 'InspectionLot' }
      }]
      @Consumption.semanticObject: 'InspectionLot'
      //@ObjectModel.readOnly: true

      _Defect.InspectionLot,

      @Consumption.filter.hidden: true
      //@ObjectModel.readOnly: true

      _Defect.InspPlanOperationInternalID,

      @Consumption.filter.hidden: true
      //@ObjectModel.readOnly: true

      _Defect.InspectionCharacteristic,

      @Consumption.filter.hidden: true
      _Defect.InspectionSubsetInternalID,

      @Consumption.filter.hidden: true
      _Defect.MaterialSample,

      @Consumption.valueHelpDefinition: [{ association: '_DefectClass' }]
      _Defect.DefectClass,

      // Production Order and Operation (use VH data source as foreign key association; with this users need only 'F4' authorization instead of '03' for getting the texts)

      @ObjectModel.foreignKey.association: '_MfgOrderVH'
      @Consumption: {
          valueHelpDefinition: [
            { association: '_MfgOrderVH' },
            { qualifier: 'ProdOrder', association:  '_ProductionOrderStdVH' }
          ]//,

          // Definition needs to done in DEFINE of MPX_EXT class (refer the logic there)

          //semanticObject: 'ProductionOrder',

          //semanticObjectMapping.additionalBinding: [{ localElement: 'ProductionOrder', element: 'ProductionOrder' }]

      }
      cast( _Defect.ProductionOrder as manufacturingorder preserving type )                                    as ProductionOrder,
      @ObjectModel.readOnly: true
      @ObjectModel.text.element: [ 'ManufacturingOrderCategoryName' ]
      _MfgOrderVH.ManufacturingOrderCategory,
      @ObjectModel.readOnly: true
      _MfgOrderVH._MfgOrderCategory._Text[1: Language = $session.system_language].ManufacturingOrderCategoryName,
      @ObjectModel.readOnly: true
      @ObjectModel.foreignKey.association: '_MfgOrderTypeVH'
      @Consumption.valueHelpDefinition: [{ association: '_MfgOrderTypeVH' }]
      cast( _MfgOrderVH.ManufacturingOrderType as manufacturingordertype preserving type )                     as ManufacturingOrderType,
      //    @ObjectModel.readOnly: true

      //    cast( _MfgOrderVH._MfgOrderType._Text[1: Language = $session.system_language].ManufacturingOrderTypeName as manufacturingordertypename preserving type ) as ManufacturingOrderTypeName,


      // Calculate the semantic object for intent based navigation based on the order category

      @ObjectModel: {
        readOnly: true,
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      }
      cast( 'ProductionOrder               ' as /ui2/semantic_object preserving type )                         as DefectOrderSemanticObject,
      @ObjectModel: {
        readOnly: true,
        virtualElement: true,
        virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      }
      cast( 'ProductionOrder                         ' as /iwfnd/med_mdl_property_name preserving type )       as DefectOrderSemObjKeyProperty,

      @ObjectModel.text.element: ['MfgOrderSequenceText']
      cast( _Defect.ProductionOrderSequence as manufacturingordersequence preserving type )                    as ProductionOrderSequence,

      @ObjectModel.readOnly: true
      //  Integrating this field via path notation causes performance issues for non-production defects

      //    _ProductionOrderSequence.MfgOrderSequenceText, // No exposure of association, as target view is not an optimal choice!

      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      @Semantics.text: true
      cast('                                        ' as mfgordersequencetext preserving type)                 as MfgOrderSequenceText,

      // Production Order and Operation (use VH data source as foreign key association; with this users need only 'F4' authorization instead of '03' for getting the texts)

      @ObjectModel.foreignKey.association: '_MfgOrdOpBySemanticKeyStdVH'
      @Consumption: {
          valueHelpDefinition: [
            { association: '_MfgOrdOpBySemanticKeyStdVH' },
            { qualifier: 'ProdnOrdOpBySemanticKey', association: '_ProdnOrdOpBySemKeyStdVH' }
          ]
      }
      cast( _Defect.ProductionOrderOperation as manufacturingorderoperation preserving type )                  as ProductionOrderOperation,

      // Work center fields

      @ObjectModel.foreignKey.association: '_MainWorkCenterStdVH'
      @Consumption.valueHelpDefinition: [{association: '_MainWorkCenterStdVH'}]
      //UX Inc

      @Consumption.semanticObject: 'WorkCenter'
      _Defect.MainWorkCenter,
      @ObjectModel.foreignKey.association: '_MainWorkCenterPlantStdVH'
      @Consumption.valueHelpDefinition: [{ entity: { name: 'I_PlantStdVH', element: 'Plant' } }]
      _Defect.MainWorkCenterPlant,
      @Consumption.hidden: true
      _Defect.WorkCenterTypeCode,
      @Consumption.hidden: true
      _Defect.MainWorkCenterInternalID,

      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_D_DEF_DET_DEFECT_CONFIG'
      _Defect.DefectConfigurationValue,

      @ObjectModel.text.element: [ 'ProductionSupplyAreaName' ]
      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_ProductionSupplyAreaStdVH',
          element: 'ProductionSupplyArea' },
          additionalBinding: [{ element: 'Plant', localElement: 'Plant', usage: #FILTER }]
        }
      ]
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.ProductionSupplyArea,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _ProductionSupplyArea._Text[1: Language = $session.system_language].ProductionSupplyAreaName,

      @ObjectModel.text.element: [ 'EWMWarehouseDescription' ]
      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_EWM_WarehouseNumberVH',
          element: 'EWMWarehouse' }
        }
      ]
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.Warehouse,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      // Because of decentral EWM process, we need to fetch the description text via SADL exit

      //_EWM_WarehouseNumber_2._Text[1: Language = $session.system_language].EWMWarehouseDescription,

      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      @Semantics.text: true
      cast( '                                        ' as /scwm/de_desc40 preserving type )                    as EWMWarehouseDescription,

      @ObjectModel.text.element: [ 'EWMStorageTypeName' ]
      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_EWM_StorageTypeVH',
          element: 'EWMStorageType' },
          additionalBinding: [{ element: 'EWMWarehouse', localElement: 'Warehouse', usage: #FILTER }]
        }
      ]
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.StorageType,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      // Because of decentral EWM process, we need to fetch the description text via SADL exit

      //_EWM_SourceStorageType._Text[1: Language = $session.system_language].EWMStorageTypeName,

      @ObjectModel.virtualElement: true
      @ObjectModel.virtualElementCalculatedBy: 'ABAP:CL_QM_C_DEFECTRECORD_EXIT'
      @Semantics.text: true
      cast( '                                        ' as /scwm/de_desc40 preserving type )                    as EWMStorageTypeName,

      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_EWM_StorageBinVH',
          element: 'EWMStorageBin' },
          additionalBinding: [{ element: 'EWMWarehouse', localElement: 'Warehouse', usage: #FILTER },
                              { element: 'EWMStorageType', localElement: 'StorageType', usage: #FILTER }]
        }
      ]
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.SourceStorageBin,

      @Consumption.hidden: true
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.WarehouseLogicalSystem,

      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.DefectCausedBy,

      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_QltyMgmtPlantCostCenterVH',
          element: 'CostCenter' },
          additionalBinding: [{ element: 'Plant', localElement: 'Plant', usage: #FILTER_AND_RESULT }]
        }
      ]
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _Defect.CostCenter,

      @ObjectModel.readOnly: true
      @ObjectModel.text.element: ['DefectLocationCatalogText']
      @Feature: 'QM_CE_DEF_LCTN_CODE'
      _Defect.DefectObjectCodeCatalog                                                                          as DefectLocationCatalog,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEF_LCTN_CODE'
      _DefectLocationCatalog._Text[1: Language = $session.system_language ].DefectLocationCatalogText,
      @ObjectModel.text.element: ['DefectLocationCodeGroupText']
      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_DefectLocationCodeGroupStdVH', element: 'DefectLocationCodeGroup' },
          additionalBinding: [{ element: 'DefectLocationCatalog', localElement: 'DefectLocationCatalog', usage: #RESULT }]
        }
      ]
      @Feature: 'QM_CE_DEF_LCTN_CODE'
      _Defect.DefectObjectCodeGroup                                                                            as DefectLocationCodeGroup,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEF_LCTN_CODE'
      _DefectLocationCodeGroup._Text[1: Language = $session.system_language ].DefectLocationCodeGroupText,
      @ObjectModel.text.element: ['DefectLocationCodeText']
      @Consumption.valueHelpDefinition: [
        { entity: { name: 'I_DefectLocationCodeStdVH', element: 'DefectLocationCode' },
          additionalBinding: [{ element: 'DefectLocationCatalog', localElement: 'DefectLocationCatalog', usage: #RESULT },
                              { element: 'DefectLocationCodeGroup', localElement: 'DefectLocationCodeGroup' }
                             ]
        }
      ]
      @Feature: 'QM_CE_DEF_LCTN_CODE'
      _Defect.DefectObjectCode                                                                                 as DefectLocationCode,
      @ObjectModel.readOnly: true
      @Feature: 'QM_CE_DEF_LCTN_CODE'
      _DefectLocationCode._DefectLocationCodeText[1: Language = $session.system_language ].DefectLocationCodeText,

      /* Associations */
      @Consumption.hidden: true
      @ObjectModel.readOnly: true
      _DefectCodeGroup,
      @Consumption.hidden: true
      @ObjectModel.readOnly: true
      _DefectCode,
      @Consumption.hidden: true
      _DefectCategory,
      @Consumption.hidden: true
      _DefectStatus,
      @Consumption.hidden: true
      _DefectStatusText,
      @Consumption.filter.hidden: true
      @VDM.lifecycle: { status: #DEPRECATED, successor: '_DefectiveQuantityUnit' }
      _DefectiveQtyUnitOfMeasure,
      @Consumption.filter.hidden: true
      _DefectiveQuantityUnit,
      @Consumption.filter.hidden: true
      _ProblemAnalysisStatus,
      @Consumption.hidden: true
      _Product,
      @Consumption.hidden: true
      _Plant,
      @Consumption.filter.hidden: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _StorageLocation,
      @Consumption.filter.hidden: true
      _DefectClass,

      @ObjectModel.association.type:  [ #TO_COMPOSITION_CHILD ]
      _DefectLongTextTP,
      @ObjectModel.association.type:  [ #TO_COMPOSITION_CHILD ]
      _DefectAffectedObjectTP,

      @Consumption.filter.hidden: true
      _DefectTaskRecord,
      @Consumption.filter.hidden: true
      _MfgExecDefectRecord,
      @Consumption.filter.hidden: true
      _DefectInspCharacteristic,
      @Consumption.filter.hidden: true
      _DefectInspSubsCharacteristic,
      @Consumption.filter.hidden: true
      _InspectionOperation,

      @Consumption.filter.hidden: true
      _CreatedByUserContactCard,
      @Consumption.filter.hidden: true
      _LastChangedByUserContactCard,

      @Consumption.filter.hidden: true
      _ProductionOrderStdVH,
      @Consumption.filter.hidden: true
      _MfgOrderVH,
      @Consumption.filter.hidden: true
      _ProdnOrdOpBySemKeyStdVH,
      @Consumption.filter.hidden: true
      _MfgOrdOpBySemanticKeyStdVH,
      @Consumption.filter.hidden: true
      _MainWorkCenterStdVH,
      @Consumption.filter.hidden: true
      _MainWorkCenterPlantStdVH,
      @Consumption.filter.hidden: true
      @Consumption.hidden: true
      _InspectionLot,

      _DefectProbSolvingProcInfo, // do not set to @Consumption.filter.hidden; filtering is wanted here.


      @ObjectModel.readOnly: true
      @Consumption.filter.hidden: true
      @UI.hidden: true
      _DefectProbSolvingProcInfo.ProbSolvingProc, // the value of ProbSolvingProc is not passed to the navigation if it is not part of the defect context, because this context is passed into the smart link


      @Consumption.filter.hidden: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _ProductionSupplyArea,
      @Consumption.filter.hidden: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _EWM_WarehouseNumber_2,
      @Consumption.filter.hidden: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _EWM_SourceStorageType,
      @Consumption.filter.hidden: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _EWM_SourceStorageBin,
      @Consumption.filter.hidden: true
      @Feature: 'QM_CE_DEFECT_WAREHOUSE_DEF'
      _DefectCausedBy,
      @Consumption.filter.hidden: true
      _MfgOrderTypeVH

}
where
     IsDeleted                                 = ''
  or _RelatedNotificationItem.ReferencedDefect is not null