I_DefectUnion

DDL: I_DEFECTUNION SQL: IDEFECTUNI Type: view COMPOSITE Package: VDM_QM_NOTIFICATION

Defects and Quality Notification Items

I_DefectUnion is a Composite CDS View that provides data about "Defects and Quality Notification Items" in SAP S/4HANA. It reads from 5 data sources (I_Defect_TP, I_Defect_TP, I_NotificationItem, I_NotificationItem, I_NotificationItem) and exposes 346 fields with key field DefectInternalID. It has 14 associations to related views. Part of development package VDM_QM_NOTIFICATION.

Data Sources (5)

SourceAliasJoin Type
I_Defect_TP I_Defect_TP from
I_Defect_TP I_Defect_TP union
I_NotificationItem I_NotificationItem union
I_NotificationItem I_NotificationItem union
I_NotificationItem I_NotificationItem union

Associations (14)

CardinalityTargetAliasCondition
[0..1] I_Notification _Notification $projection.Notification = _Notification.Notification
[0..1] I_NotificationType _NotificationType $projection.NotificationType = _NotificationType.NotificationType
[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_DefectCodeGroup _DefectCodeGroup $projection.DefectCodeGroup = _DefectCodeGroup.DefectCodeGroup
[0..1] I_DefectCode _DefectCode $projection.DefectCodeGroup = _DefectCode.DefectCodeGroup and $projection.DefectCode = _DefectCode.DefectCode
[0..1] I_InspectionLot _InspectionLot $projection.inspectionlot = _InspectionLot.InspectionLot
[0..1] I_DefectStatus _DefectStatus $projection.DefectLifecycleStatus = _DefectStatus.DefectLifecycleStatus
[0..1] I_DefectCausedBy _DefectCausedBy $projection.DefectCausedBy = _DefectCausedBy.DefectCausedBy
[0..1] I_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2 $projection.Warehouse = _EWM_WarehouseNumber_2.EWMWarehouse
[0..1] I_EWM_WarehouseNumber _EWM_WarehouseNumber $projection.Warehouse = _EWM_WarehouseNumber.Warehouse
[0..1] I_UserContactCard _CreatedByUserContactCard $projection.CreatedByUser = _CreatedByUserContactCard.ContactCardID
[0..1] I_Defect_TP _ReferencedDefect $projection.ReferencedDefect = _ReferencedDefect.DefectInternalID

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName IDEFECTUNI view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #COMPOSITE view
VDM.lifecycle.contract.type #SAP_INTERNAL_API view
AccessControl.authorizationCheck #CHECK view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.representativeKey DefectInternalID view
EndUserText.label Defects and Quality Notification Items view

Fields (346)

KeyFieldSource TableSource FieldDescription
KEY DefectInternalID DefectInternalID
Notification
NotificationItem
NotificationItemExternalID
Defect Defect
DefectCategory DefectCategory
CreatedByUser CreatedByUser
CreationDate CreationDate
CreationTime CreationTime
LastChangedByUser LastChangedByUser
LastChangeDate LastChangeDate
LastChangeTime LastChangeTime
DefectText DefectText
DefectCodeCatalog DefectCodeCatalog
DefectCodeGroup DefectCodeGroup
DefectCode DefectCode
DefectCodeVersion DefectCodeVersion
DefectLocationCatalog DefectObjectCodeCatalog
DefectLocationCodeGroup DefectObjectCodeGroup
DefectLocationCode DefectObjectCode
DefectClass DefectClass
NumberOfDefects NumberOfDefects
DefectLifecycleStatus DefectLifecycleStatus
ReferencedDefect
Plant Plant
Material Material
Batch Batch
InspectionLot InspectionLot
InspPlanOperationInternalID InspPlanOperationInternalID
InspectionCharacteristic InspectionCharacteristic
InspectionSubsetInternalID InspectionSubsetInternalID
MaterialSample MaterialSample
Supplier
Customer
NotificationType
ProductionOrder ProductionOrder
ProductionOrderOperation ProductionOrderOperation
ProductionOrderSequence ProductionOrderSequence
WorkCenterTypeCode WorkCenterTypeCode
MainWorkCenterInternalID MainWorkCenterInternalID
MainWorkCenterPlant MainWorkCenterPlant
MainWorkCenter MainWorkCenter
StorageLocation StorageLocation
ProductionSupplyArea ProductionSupplyArea
Warehouse Warehouse
StorageType StorageType
SourceStorageBin SourceStorageBin
WarehouseLogicalSystem WarehouseLogicalSystem
IsDeleted IsDeleted
DefectOrigin DefectOrigin
DefectCausedBy DefectCausedBy
DefectUUID DefectUUID
_Notification _Notification
_NotificationType _NotificationType
_DefectCategory _DefectCategory
_DefectCodeGroup _DefectCodeGroup
_DefectCode _DefectCode
_DefectLocationCatalog _DefectLocationCatalog
_DefectLocationCodeGroup _DefectLocationCodeGroup
_DefectLocationCode _DefectLocationCode
_DefectClass _DefectClass
_DefectStatus _DefectStatus
_DefectCausedBy _DefectCausedBy
_Plant _Plant
_Product _Product
_InspectionLot _InspectionLot
_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2
_EWM_WarehouseNumber _EWM_WarehouseNumber
_CreatedByUserContactCard _CreatedByUserContactCard
DefectLocationCodekeyDefectInternalID
Notification
NotificationItem
NotificationItemExternalID
Defect Defect
DefectCategory DefectCategory
CreatedByUser CreatedByUser
CreationDate CreationDate
CreationTime CreationTime
LastChangedByUser LastChangedByUser
LastChangeDate LastChangeDate
LastChangeTime LastChangeTime
DefectText DefectText
DefectCodeCatalog DefectCodeCatalog
DefectCodeGroup DefectCodeGroup
DefectCode DefectCode
DefectCodeVersion DefectCodeVersion
DefectLocationCatalog DefectObjectCodeCatalog
DefectLocationCodeGroup DefectObjectCodeGroup
DefectLocationCode DefectObjectCode
DefectClass DefectClass
NumberOfDefects NumberOfDefects
DefectLifecycleStatus DefectLifecycleStatus
ReferencedDefect
Plant Plant
Material Material
Batch _InspectionLot Batch
InspectionLot InspectionLot
InspPlanOperationInternalID InspPlanOperationInternalID
InspectionCharacteristic InspectionCharacteristic
InspectionSubsetInternalID InspectionSubsetInternalID
MaterialSample MaterialSample
Supplier
Customer
NotificationType
ProductionOrder _InspectionLot ManufacturingOrder
ProductionOrderOperation ProductionOrderOperation
ProductionOrderSequence ProductionOrderSequence
WorkCenterTypeCode WorkCenterTypeCode
MainWorkCenterInternalID MainWorkCenterInternalID
MainWorkCenterPlant MainWorkCenterPlant
MainWorkCenter MainWorkCenter
StorageLocation StorageLocation
ProductionSupplyArea ProductionSupplyArea
Warehouse Warehouse
StorageType StorageType
SourceStorageBin SourceStorageBin
WarehouseLogicalSystem WarehouseLogicalSystem
IsDeleted IsDeleted
DefectOrigin DefectOrigin
DefectCausedBy DefectCausedBy
DefectUUID DefectUUID
_Notification _Notification
_NotificationType _NotificationType
_DefectCategory _DefectCategory
_DefectCodeGroup _DefectCodeGroup
_DefectCode _DefectCode
_DefectLocationCatalog _DefectLocationCatalog
_DefectLocationCodeGroup _DefectLocationCodeGroup
_DefectLocationCode _DefectLocationCode
_DefectClass _DefectClass
_DefectStatus _DefectStatus
_DefectCausedBy _DefectCausedBy
_Plant _Plant
_Product _Product
_InspectionLot _InspectionLot
_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2
_EWM_WarehouseNumber _EWM_WarehouseNumber
_CreatedByUserContactCard _CreatedByUserContactCard
DefectInternalIDkeyDefectInternalID
Notification I_NotificationItem Notification
NotificationItem I_NotificationItem NotificationItem
NotificationItemExternalID
Defect
DefectCategory DefectCategory
CreatedByUser
CreationDate
CreationTime
LastChangedByUser I_NotificationItem LastChangedByUser
LastChangeDate I_NotificationItem LastChangeDate
LastChangeTime
DefectText NotificationItemText
DefectCodeCatalog DefectCodeCatalog
DefectCodeGroup DefectCodeGroup
DefectCode DefectCode
DefectCodeVersion DefectCodeVersion
DefectLocationCatalog
DefectLocationCodeGroup
DefectLocationCode
DefectClass DefectClass
NumberOfDefects NumberOfDefects
DefectLifecycleStatus
ReferencedDefect ReferencedDefect
Plant Plant
Material Assembly
Batch Batch
InspectionLot _ReferencedDefect InspectionLot
InspPlanOperationInternalID _ReferencedDefect InspPlanOperationInternalID
InspectionCharacteristic _ReferencedDefect InspectionCharacteristic
InspectionSubsetInternalID _ReferencedDefect InspectionSubsetInternalID
MaterialSample _ReferencedDefect MaterialSample
Supplier _Notification Supplier
Customer _Notification Customer
NotificationType _Notification NotificationType
ProductionOrder _ReferencedDefect ProductionOrder
ProductionOrderOperation _ReferencedDefect ProductionOrderOperation
ProductionOrderSequence _ReferencedDefect ProductionOrderSequence
WorkCenterTypeCode _Notification WorkCenterTypeCode
MainWorkCenterInternalID _Notification MainWorkCenterInternalID
MainWorkCenterPlant _Notification MainWorkCenterPlant
MainWorkCenter MainWorkCenter
StorageLocation I_NotificationItem StorageLocation
ProductionSupplyArea I_NotificationItem ProductionSupplyArea
Warehouse I_NotificationItem EWMWarehouse
StorageType I_NotificationItem SourceStorageType
SourceStorageBin I_NotificationItem SourceStorageBin
WarehouseLogicalSystem I_NotificationItem WarehouseLogicalSystem
IsDeleted I_NotificationItem IsDeleted
DefectOrigin I_NotificationItem DefectOrigin
DefectCausedBy DefectCausedBy
DefectUUID DefectUUID
_Notification _Notification
_NotificationType _NotificationType
_DefectCategory _DefectCategory
_DefectCodeGroup _DefectCodeGroup
_DefectCode _DefectCode
_DefectLocationCatalog _DefectLocationCatalog
_DefectLocationCodeGroup _DefectLocationCodeGroup
_DefectLocationCode _DefectLocationCode
_DefectClass _DefectClass
_DefectStatus _DefectStatus
_DefectCausedBy _DefectCausedBy
_Plant _Plant
_Product _Assembly
_InspectionLot _InspectionLot
_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2
_EWM_WarehouseNumber _EWM_WarehouseNumber
_CreatedByUserContactCard _CreatedByUserContactCard
DefectInternalIDkeyDefectInternalID
Notification I_NotificationItem Notification
NotificationItem I_NotificationItem NotificationItem
NotificationItemExternalID
Defect
DefectCategory DefectCategory
CreatedByUser
CreationDate
CreationTime
LastChangedByUser I_NotificationItem LastChangedByUser
LastChangeDate I_NotificationItem LastChangeDate
LastChangeTime
DefectText NotificationItemText
DefectCodeCatalog DefectCodeCatalog
DefectCodeGroup DefectCodeGroup
DefectCode DefectCode
DefectCodeVersion DefectCodeVersion
DefectLocationCatalog
DefectLocationCodeGroup
DefectLocationCode
DefectClass DefectClass
NumberOfDefects NumberOfDefects
DefectLifecycleStatus
ReferencedDefect ReferencedDefect
Plant Plant
Material Assembly
Batch Batch
InspectionLot _ReferencedDefect InspectionLot
InspPlanOperationInternalID _ReferencedDefect InspPlanOperationInternalID
InspectionCharacteristic _ReferencedDefect InspectionCharacteristic
InspectionSubsetInternalID _ReferencedDefect InspectionSubsetInternalID
MaterialSample _ReferencedDefect MaterialSample
Supplier _Notification Supplier
Customer _Notification Customer
NotificationType _Notification NotificationType
ProductionOrder
ProductionOrderOperation _ReferencedDefect ProductionOrderOperation
ProductionOrderSequence _ReferencedDefect ProductionOrderSequence
WorkCenterTypeCode _Notification WorkCenterTypeCode
MainWorkCenterInternalID _Notification MainWorkCenterInternalID
MainWorkCenterPlant _Notification MainWorkCenterPlant
MainWorkCenter MainWorkCenter
StorageLocation I_NotificationItem StorageLocation
ProductionSupplyArea I_NotificationItem ProductionSupplyArea
Warehouse I_NotificationItem EWMWarehouse
StorageType I_NotificationItem SourceStorageType
SourceStorageBin I_NotificationItem SourceStorageBin
WarehouseLogicalSystem I_NotificationItem WarehouseLogicalSystem
IsDeleted I_NotificationItem IsDeleted
DefectOrigin I_NotificationItem DefectOrigin
DefectCausedBy DefectCausedBy
DefectUUID DefectUUID
_Notification _Notification
_NotificationType _NotificationType
_DefectCategory _DefectCategory
_DefectCodeGroup _DefectCodeGroup
_DefectCode _DefectCode
_DefectLocationCatalog _DefectLocationCatalog
_DefectLocationCodeGroup _DefectLocationCodeGroup
_DefectLocationCode _DefectLocationCode
_DefectClass _DefectClass
_DefectStatus _DefectStatus
_DefectCausedBy _DefectCausedBy
_Plant _Plant
_Product _Assembly
_InspectionLot _InspectionLot
_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2
_EWM_WarehouseNumber _EWM_WarehouseNumber
_CreatedByUserContactCard _CreatedByUserContactCard
DefectLocationCodekeyDefectInternalID
Notification I_NotificationItem Notification
NotificationItem NotificationItem
NotificationItemExternalID
Defect
DefectCategory DefectCategory
CreatedByUser I_NotificationItem CreatedByUser
CreationDate I_NotificationItem CreationDate
CreationTime
LastChangedByUser I_NotificationItem LastChangedByUser
LastChangeDate I_NotificationItem LastChangeDate
LastChangeTime
DefectText NotificationItemText
DefectCodeCatalog DefectCodeCatalog
DefectCodeGroup DefectCodeGroup
DefectCode DefectCode
DefectCodeVersion DefectCodeVersion
DefectLocationCatalog
DefectLocationCodeGroup
DefectLocationCode
DefectClass DefectClass
NumberOfDefects NumberOfDefects
DefectLifecycleStatus
ReferencedDefect ReferencedDefect
Plant _Notification Plant
Material _Notification Material
Batch _Notification Batch
InspectionLot _Notification InspectionLot
InspPlanOperationInternalID InspPlanOperationInternalID
InspectionCharacteristic InspectionCharacteristic
InspectionSubsetInternalID InspectionSubsetInternalID
MaterialSample MaterialSample
Supplier _Notification Supplier
Customer _Notification Customer
NotificationType _Notification NotificationType
ProductionOrder
ProductionOrderOperation
ProductionOrderSequence
WorkCenterTypeCode _Notification WorkCenterTypeCode
MainWorkCenterInternalID _Notification MainWorkCenterInternalID
MainWorkCenterPlant _Notification MainWorkCenterPlant
MainWorkCenter MainWorkCenter
StorageLocation
ProductionSupplyArea
Warehouse
StorageType
SourceStorageBin
WarehouseLogicalSystem
IsDeleted I_NotificationItem IsDeleted
DefectOrigin I_NotificationItem DefectOrigin
DefectCausedBy
DefectUUID DefectUUID
_Notification _Notification
_NotificationType _NotificationType
_DefectCategory _DefectCategory
_DefectCodeGroup _DefectCodeGroup
_DefectCode _DefectCode
_DefectLocationCatalog _DefectLocationCatalog
_DefectLocationCodeGroup _DefectLocationCodeGroup
_DefectLocationCode _DefectLocationCode
_DefectClass _DefectClass
_DefectStatus _DefectStatus
_DefectCausedBy _DefectCausedBy
_Plant _Notification _Plant
_Product _Notification _Product
_InspectionLot _InspectionLot
_EWM_WarehouseNumber_2 _EWM_WarehouseNumber_2
_EWM_WarehouseNumber _EWM_WarehouseNumber
_CreatedByUserContactCard _CreatedByUserContactCard
_LastChangedByUserContactCard _LastChangedByUserContactCard
@AbapCatalog.sqlViewName: 'IDEFECTUNI'
@AbapCatalog.compiler.compareFilter:true
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM: {
    viewType: #COMPOSITE,
    lifecycle.contract.type: #SAP_INTERNAL_API
}
@AccessControl.authorizationCheck: #CHECK
@ObjectModel: {
    usageType: {
        dataClass: #TRANSACTIONAL,
        sizeCategory: #S,
        serviceQuality: #C },
    representativeKey: 'DefectInternalID',
    semanticKey:  [ 'Defect' ]
}
@Consumption.dbHints: [ 'USE_HEX_PLAN' ]

@EndUserText.label: 'Defects and Quality Notification Items'

/* 1a. independent defects - except categories 01 to 05 */
define view I_DefectUnion as select from I_Defect_TP
    //this associatons are just defined so that the same association for notification items can be (1) exposed and (2) be used in the DCL to inherit the condition!

    association [0..1] to I_Notification as _Notification on $projection.Notification = _Notification.Notification
    association [0..1] to I_NotificationType as _NotificationType on $projection.NotificationType = _NotificationType.NotificationType

    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
                                                                                      
{

    key DefectInternalID, //contains value from QMFE.QMNUM


    cast( '            ' as qmnum preserving type )      as Notification,
    cast( '0000' as felfd preserving type )              as NotificationItem,
    cast( '0000' as qnotifitemexternal preserving type ) as NotificationItemExternalID,

    Defect,

    DefectCategory,
    CreatedByUser,
    CreationDate,
    CreationTime,
    LastChangedByUser,
    LastChangeDate,
    LastChangeTime,
    DefectText,
    DefectCodeCatalog,
    DefectCodeGroup,
    DefectCode,
    DefectCodeVersion,
    @ObjectModel.foreignKey.association: '_DefectLocationCatalog'
    DefectObjectCodeCatalog   as DefectLocationCatalog,
    @ObjectModel.foreignKey.association: '_DefectLocationCodeGroup'
    DefectObjectCodeGroup     as DefectLocationCodeGroup,
    @ObjectModel.foreignKey.association: '_DefectLocationCode'
    DefectObjectCode          as DefectLocationCode,
//    DefectObjectCodeVersion   as DefectLocationCodeVersion,

    DefectClass,
    NumberOfDefects,
    DefectLifecycleStatus,
    cast( '            ' as qdefrefnum preserving type ) as ReferencedDefect,
    
    Plant,
    Material,
    Batch,
    InspectionLot,
    InspPlanOperationInternalID,
    InspectionCharacteristic,
    InspectionSubsetInternalID,
    MaterialSample,
    
    cast( '          ' as elifn preserving type ) as Supplier,
    cast( '          ' as qkunwe preserving type ) as Customer,
    @ObjectModel.foreignKey.association: '_NotificationType'
    cast( '  '         as qmart preserving type ) as NotificationType,

//  For defects with production order and operation

    ProductionOrder,
//    ProductionOrder as ManufacturingOrder,

    ProductionOrderOperation,
    ProductionOrderSequence,

//  Work center fields

    WorkCenterTypeCode,
    MainWorkCenterInternalID,
    MainWorkCenterPlant,
    MainWorkCenter,
    
//  EWM related fields

    StorageLocation,
    ProductionSupplyArea,
    Warehouse,
    StorageType,
    SourceStorageBin,
    WarehouseLogicalSystem,

    IsDeleted,
    DefectOrigin,
    DefectCausedBy,
    DefectUUID,
    
    _Notification,
    _NotificationType,
    _DefectCategory,
    _DefectCodeGroup,
    _DefectCode,
    _DefectLocationCatalog,
    _DefectLocationCodeGroup,
    _DefectLocationCode,
    _DefectClass,
    _DefectStatus,
    _DefectCausedBy,
    _Plant,
    _Product,
    _InspectionLot,
    _EWM_WarehouseNumber_2,
    @VDM.lifecycle: { status: #DEPRECATED, successor: '_EWM_WarehouseNumber_2' }
    _EWM_WarehouseNumber,
    _CreatedByUserContactCard,
    _LastChangedByUserContactCard

} where 
    // Independent defects, except the one related to inspection lot and inspection results

        DefectCategory <> '' 
    and DefectCategory <> '01' and DefectCategory <> '02' and DefectCategory <> '03' and DefectCategory <> '04' and DefectCategory <> '05'
    and IsDeleted <> 'X'

/* 1b. independent defects - only categories 01 to 05 */
union select from I_Defect_TP
    //this associatons are just defined so that the same association for notification items can be (1) exposed and (2) be used in the DCL to inherit the condition!

    association [0..1] to I_Notification as _Notification on $projection.Notification = _Notification.Notification
    association [0..1] to I_NotificationType as _NotificationType on $projection.NotificationType = _NotificationType.NotificationType

    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

{

    key DefectInternalID, //contains value from QMFE.QMNUM


    cast( '            ' as qmnum preserving type )      as Notification,
    cast( '0000' as felfd preserving type )              as NotificationItem,
    cast( '0000' as qnotifitemexternal preserving type ) as NotificationItemExternalID,

    Defect,

    DefectCategory,
    CreatedByUser,
    CreationDate,
    CreationTime,
    LastChangedByUser,
    LastChangeDate,
    LastChangeTime,
    DefectText,
    DefectCodeCatalog,
    DefectCodeGroup,
    DefectCode,
    DefectCodeVersion,
    @ObjectModel.foreignKey.association: '_DefectLocationCatalog'
    DefectObjectCodeCatalog   as DefectLocationCatalog,
    @ObjectModel.foreignKey.association: '_DefectLocationCodeGroup'
    DefectObjectCodeGroup     as DefectLocationCodeGroup,
    @ObjectModel.foreignKey.association: '_DefectLocationCode'
    DefectObjectCode          as DefectLocationCode,
//    DefectObjectCodeVersion   as DefectLocationCodeVersion,

    DefectClass,
    NumberOfDefects,
    DefectLifecycleStatus,
    cast( '            ' as qdefrefnum preserving type ) as ReferencedDefect,
    
    Plant,
    Material,
    _InspectionLot.Batch,
    InspectionLot,
    InspPlanOperationInternalID,
    InspectionCharacteristic,
    InspectionSubsetInternalID,
    MaterialSample,
    
    cast( '          ' as elifn preserving type ) as Supplier,
    cast( '          ' as qkunwe preserving type ) as Customer,
    @ObjectModel.foreignKey.association: '_NotificationType'
    cast( '  '         as qmart preserving type ) as NotificationType,

//  For defects with reference to an inspection lot, the order data are not stored in the defect

    _InspectionLot.ManufacturingOrder as ProductionOrder,
    ProductionOrderOperation,
    ProductionOrderSequence,

//  Work center fields

    WorkCenterTypeCode,
    MainWorkCenterInternalID,
    MainWorkCenterPlant,
    MainWorkCenter,
    
//  EWM related fields

    StorageLocation,
    ProductionSupplyArea,
    Warehouse,
    StorageType,
    SourceStorageBin,
    WarehouseLogicalSystem,

    IsDeleted,
    DefectOrigin,
    DefectCausedBy,
    DefectUUID,

    _Notification,
    _NotificationType,
    _DefectCategory,
    _DefectCodeGroup,
    _DefectCode,
    _DefectLocationCatalog,
    _DefectLocationCodeGroup,
    _DefectLocationCode,
    _DefectClass,
    _DefectStatus,
    _DefectCausedBy,
    _Plant,
    _Product,
    _InspectionLot,
    _EWM_WarehouseNumber_2,
    @VDM.lifecycle: { status: #DEPRECATED, successor: '_EWM_WarehouseNumber_2' }
    _EWM_WarehouseNumber,
    _CreatedByUserContactCard,
    _LastChangedByUserContactCard

} where 
  // Categories related to inspection lot and inspection results

  ( DefectCategory = '01' or DefectCategory = '02' or DefectCategory = '03' or DefectCategory = '04' or DefectCategory = '05' )
  and 
  IsDeleted <> 'X'

/* 2a. notification items - with referenced independent defect - except (referenced) categories 01 to 05 */
union select from I_NotificationItem
    //inner join to I_Notification via association _Notification is intended


    association [0..1] to I_NotificationType as _NotificationType               on $projection.notificationtype = _NotificationType.NotificationType
    
    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_InspectionLot       as _InspectionLot               on  $projection.inspectionlot       = _InspectionLot.InspectionLot
    association [0..1] to I_DefectStatus        as _DefectStatus                on  $projection.DefectLifecycleStatus = _DefectStatus.DefectLifecycleStatus
    association [0..1] to I_DefectCausedBy      as _DefectCausedBy              on $projection.DefectCausedBy = _DefectCausedBy.DefectCausedBy
    
    association [0..1] to I_EWM_WarehouseNumber_2   as _EWM_WarehouseNumber_2   on $projection.Warehouse = _EWM_WarehouseNumber_2.EWMWarehouse
    association [0..1] to I_EWM_WarehouseNumber     as _EWM_WarehouseNumber     on $projection.Warehouse = _EWM_WarehouseNumber.Warehouse
                                                                               
    association [0..1] to I_UserContactCard     as _CreatedByUserContactCard    on  $projection.CreatedByUser        = _CreatedByUserContactCard.ContactCardID

    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_Defect_TP                  as _ReferencedDefect           on  $projection.ReferencedDefect = _ReferencedDefect.DefectInternalID

{

    key DefectInternalID, //contains value from QMFE.INTERNALID


    I_NotificationItem.Notification,
    I_NotificationItem.NotificationItem,
    cast( NotificationItemExternalID as qnotifitemexternal preserving type ) as NotificationItemExternalID,

    cast( substring(ReferencedDefect,2,11) as qdefectid preserving type )    as Defect,

    DefectCategory,
    
    //for notification items that reference a defect the 'original' creation data is taken from ReportingDate/Time/User (cast to dataelements fitting to the new field name)

    cast( I_NotificationItem.NotifItmReportedByUser as ernam preserving type )           as CreatedByUser,
    cast( I_NotificationItem.NotifItmReportingDate as erdat preserving type )            as CreationDate,
    cast( I_NotificationItem.NotifItmReportingTime as vdm_qerstezeit preserving type )   as CreationTime,

    I_NotificationItem.LastChangedByUser,
    I_NotificationItem.LastChangeDate,
    cast( I_NotificationItem.LastChangeTime as vdm_qaendezeit preserving type ) as LastChangeTime,
    NotificationItemText as DefectText,
    DefectCodeCatalog,
    DefectCodeGroup,
    DefectCode,
    DefectCodeVersion,
    @ObjectModel.foreignKey.association: '_DefectLocationCatalog'
    cast( NotifItmObjectPartCodeCtlg as vdm_qfeocat preserving type )  as DefectLocationCatalog,
    @ObjectModel.foreignKey.association: '_DefectLocationCodeGroup'
    cast( NotifItmObjectPartCodeGroup as vdm_qfeogrp preserving type ) as DefectLocationCodeGroup,
    @ObjectModel.foreignKey.association: '_DefectLocationCode'
    cast( NotifItmObjectPartCode as vdm_qfeocod preserving type )      as DefectLocationCode,
//    NotifItmObjectPartVersion   as DefectLocationCodeVersion,

    DefectClass,
    NumberOfDefects,
    cast( '  ' as qdeflcyclestat preserving type ) as DefectLifecycleStatus,
    ReferencedDefect,
    
    Plant,
    // Transfer from a Defect: Defect: MATNR -> NotificationItem: BAUTL

    Assembly as Material,
    Batch,
    // For item with referenced defect, fetch inspection data from this reference

    _ReferencedDefect.InspectionLot,
    _ReferencedDefect.InspPlanOperationInternalID,
    _ReferencedDefect.InspectionCharacteristic,
    _ReferencedDefect.InspectionSubsetInternalID,
    _ReferencedDefect.MaterialSample,
    
    _Notification.Supplier,
    _Notification.Customer,
    @ObjectModel.foreignKey.association: '_NotificationType'
    _Notification.NotificationType,

    // For item with referenced defect, fetch manufacturing/ production data from this reference

    _ReferencedDefect.ProductionOrder,
    _ReferencedDefect.ProductionOrderOperation,
    _ReferencedDefect.ProductionOrderSequence,
    
    _Notification.WorkCenterTypeCode,
    _Notification.MainWorkCenterInternalID,
    _Notification.MainWorkCenterPlant,
    MainWorkCenter,

//  EWM related fields

    I_NotificationItem.StorageLocation,
    I_NotificationItem.ProductionSupplyArea,
    I_NotificationItem.EWMWarehouse            as Warehouse,
    I_NotificationItem.SourceStorageType       as StorageType,
    I_NotificationItem.SourceStorageBin,
    I_NotificationItem.WarehouseLogicalSystem,
    
    I_NotificationItem.IsDeleted,
    I_NotificationItem.DefectOrigin,
    DefectCausedBy,
    DefectUUID,

    _Notification,
    _NotificationType,
    _DefectCategory,
    _DefectCodeGroup,
    _DefectCode,
    _DefectLocationCatalog,
    _DefectLocationCodeGroup,
    _DefectLocationCode,
    _DefectClass,
    _DefectStatus,
    _DefectCausedBy,
    _Plant,
    _Assembly as _Product,
    _InspectionLot,
    _EWM_WarehouseNumber_2,
    @VDM.lifecycle: { status: #DEPRECATED, successor: '_EWM_WarehouseNumber_2' }
    _EWM_WarehouseNumber,
    _CreatedByUserContactCard,
    _LastChangedByUserContactCard

} where //select only notification items

        DefectCategory = ''
        //and only from quality notifications

        and ( _Notification.NotificationOrigin = 'Q1' or _Notification.NotificationOrigin = 'Q2' or _Notification.NotificationOrigin = 'Q3' )
        //and only those that have the new ID assigned

        and DefectInternalID <> ''
        //and with referenced defect

        and ReferencedDefect <> ''
        // Independent defects, except the one related to inspection lot and inspection results

        and _ReferencedDefect.DefectCategory <> '' 
        and _ReferencedDefect.DefectCategory <> '01' and _ReferencedDefect.DefectCategory <> '02' and _ReferencedDefect.DefectCategory <> '03' and _ReferencedDefect.DefectCategory <> '04' and _ReferencedDefect.DefectCategory <> '05'
        and IsDeleted <> 'X'
        and _Notification.NotifProcessingPhase <> '5'

/* 2b. notification items - with referenced independent defect - only (referenced) categories 01 to 05 */
union select from I_NotificationItem
    //inner join to I_Notification via association _Notification is intended


    association [0..1] to I_NotificationType as _NotificationType               on $projection.notificationtype = _NotificationType.NotificationType
    
    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_InspectionLot       as _InspectionLot               on  $projection.inspectionlot       = _InspectionLot.InspectionLot
    association [0..1] to I_DefectStatus        as _DefectStatus                on  $projection.DefectLifecycleStatus = _DefectStatus.DefectLifecycleStatus
    association [0..1] to I_DefectCausedBy      as _DefectCausedBy              on $projection.DefectCausedBy = _DefectCausedBy.DefectCausedBy
    
    association [0..1] to I_EWM_WarehouseNumber_2   as _EWM_WarehouseNumber_2   on $projection.Warehouse = _EWM_WarehouseNumber_2.EWMWarehouse
    association [0..1] to I_EWM_WarehouseNumber     as _EWM_WarehouseNumber     on $projection.Warehouse = _EWM_WarehouseNumber.Warehouse
                                                                               
    association [0..1] to I_UserContactCard     as _CreatedByUserContactCard    on  $projection.CreatedByUser        = _CreatedByUserContactCard.ContactCardID

    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_Defect_TP                  as _ReferencedDefect           on  $projection.ReferencedDefect = _ReferencedDefect.DefectInternalID

{

    key DefectInternalID, //contains value from QMFE.INTERNALID


    I_NotificationItem.Notification,
    I_NotificationItem.NotificationItem,
    cast( NotificationItemExternalID as qnotifitemexternal preserving type ) as NotificationItemExternalID,

    cast( substring(ReferencedDefect,2,11) as qdefectid preserving type )    as Defect,

    DefectCategory,
    
    //for notification items that reference a defect the 'original' creation data is taken from ReportingDate/Time/User (cast to dataelements fitting to the new field name)

    cast( I_NotificationItem.NotifItmReportedByUser as ernam preserving type )           as CreatedByUser,
    cast( I_NotificationItem.NotifItmReportingDate as erdat preserving type )            as CreationDate,
    cast( I_NotificationItem.NotifItmReportingTime as vdm_qerstezeit preserving type )   as CreationTime,

    I_NotificationItem.LastChangedByUser,
    I_NotificationItem.LastChangeDate,
    cast( I_NotificationItem.LastChangeTime as vdm_qaendezeit preserving type ) as LastChangeTime,
    NotificationItemText as DefectText,
    DefectCodeCatalog,
    DefectCodeGroup,
    DefectCode,
    DefectCodeVersion,
    @ObjectModel.foreignKey.association: '_DefectLocationCatalog'
    cast( NotifItmObjectPartCodeCtlg as vdm_qfeocat preserving type )  as DefectLocationCatalog,
    @ObjectModel.foreignKey.association: '_DefectLocationCodeGroup'
    cast( NotifItmObjectPartCodeGroup as vdm_qfeogrp preserving type ) as DefectLocationCodeGroup,
    @ObjectModel.foreignKey.association: '_DefectLocationCode'
    cast( NotifItmObjectPartCode as vdm_qfeocod preserving type )      as DefectLocationCode,
//    NotifItmObjectPartVersion   as DefectLocationCodeVersion,

    DefectClass,
    NumberOfDefects,
    cast( '  ' as qdeflcyclestat preserving type ) as DefectLifecycleStatus,
    ReferencedDefect,
    
    Plant,
    // Transfer from a Defect: Defect: MATNR -> NotificationItem: BAUTL

    Assembly as Material,
    Batch,
    // For item with referenced defect, fetch inspection data from this reference

    _ReferencedDefect.InspectionLot,
    _ReferencedDefect.InspPlanOperationInternalID,
    _ReferencedDefect.InspectionCharacteristic,
    _ReferencedDefect.InspectionSubsetInternalID,
    _ReferencedDefect.MaterialSample,
    
    _Notification.Supplier,
    _Notification.Customer,
    @ObjectModel.foreignKey.association: '_NotificationType'
    _Notification.NotificationType,

    // For item with referenced defect, fetch manufacturing/ production data from this reference

    // For defects with reference to an inspection lot, the order data are not stored in the defect

    _ReferencedDefect._InspectionLot.ManufacturingOrder as ProductionOrder,
    _ReferencedDefect.ProductionOrderOperation,
    _ReferencedDefect.ProductionOrderSequence,
    
    _Notification.WorkCenterTypeCode,
    _Notification.MainWorkCenterInternalID,
    _Notification.MainWorkCenterPlant,
    MainWorkCenter,

//  EWM related fields

    I_NotificationItem.StorageLocation,
    I_NotificationItem.ProductionSupplyArea,
    I_NotificationItem.EWMWarehouse            as Warehouse,
    I_NotificationItem.SourceStorageType       as StorageType,
    I_NotificationItem.SourceStorageBin,
    I_NotificationItem.WarehouseLogicalSystem,
    
    I_NotificationItem.IsDeleted,
    I_NotificationItem.DefectOrigin,
    DefectCausedBy,
    DefectUUID,

    _Notification,
    _NotificationType,
    _DefectCategory,
    _DefectCodeGroup,
    _DefectCode,
    _DefectLocationCatalog,
    _DefectLocationCodeGroup,
    _DefectLocationCode,
    _DefectClass,
    _DefectStatus,
    _DefectCausedBy,
    _Plant,
    _Assembly as _Product,
    _InspectionLot,
    _EWM_WarehouseNumber_2,
    @VDM.lifecycle: { status: #DEPRECATED, successor: '_EWM_WarehouseNumber_2' }
    _EWM_WarehouseNumber,
    _CreatedByUserContactCard,
    _LastChangedByUserContactCard

} where //select only notification items

        DefectCategory = ''
        //and only from quality notifications

        and ( _Notification.NotificationOrigin = 'Q1' or _Notification.NotificationOrigin = 'Q2' or _Notification.NotificationOrigin = 'Q3' )
        //and only those that have the new ID assigned

        and DefectInternalID <> ''
        //and with referenced defect

        and ReferencedDefect <> ''
        // Categories related to inspection lot and inspection results

        and ( _ReferencedDefect.DefectCategory = '01' or _ReferencedDefect.DefectCategory = '02' or _ReferencedDefect.DefectCategory = '03' or _ReferencedDefect.DefectCategory = '04' or _ReferencedDefect.DefectCategory = '05' )
        and IsDeleted <> 'X'
        and _Notification.NotifProcessingPhase <> '5'
                
/* 3. notification items - w/o referenced independent defect */
union select from I_NotificationItem
    //inner join to I_Notification via association _Notification is intended

    
    association [0..1] to I_NotificationType as _NotificationType               on $projection.notificationtype = _NotificationType.NotificationType
    
    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_InspectionLot       as _InspectionLot               on  $projection.inspectionlot       = _InspectionLot.InspectionLot    
    association [0..1] to I_DefectStatus        as _DefectStatus                on  $projection.DefectLifecycleStatus = _DefectStatus.DefectLifecycleStatus
    association [0..1] to I_DefectCausedBy      as _DefectCausedBy              on $projection.DefectCausedBy = _DefectCausedBy.DefectCausedBy
    
    association [0..1] to I_EWM_WarehouseNumber_2   as _EWM_WarehouseNumber_2   on $projection.Warehouse = _EWM_WarehouseNumber_2.EWMWarehouse
    association [0..1] to I_EWM_WarehouseNumber     as _EWM_WarehouseNumber     on $projection.Warehouse = _EWM_WarehouseNumber.Warehouse

    association [0..1] to I_UserContactCard     as _CreatedByUserContactCard    on  $projection.CreatedByUser        = _CreatedByUserContactCard.ContactCardID

    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

{

    key DefectInternalID, //contains value from QMFE.INTERNALID


    I_NotificationItem.Notification,
    NotificationItem,
    cast( NotificationItemExternalID as qnotifitemexternal preserving type ) as NotificationItemExternalID,

    cast( substring(DefectInternalID,2,11) as qdefectid preserving type )    as Defect,

    DefectCategory,
    
    //for notification items that not reference a defect the creation data are taken from the original fields

    I_NotificationItem.CreatedByUser,
    I_NotificationItem.CreationDate,
    cast( I_NotificationItem.CreationTime   as vdm_qerstezeit preserving type ) as CreationTime,

    I_NotificationItem.LastChangedByUser,
    I_NotificationItem.LastChangeDate,
    cast( I_NotificationItem.LastChangeTime as vdm_qaendezeit preserving type ) as LastChangeTime,
    NotificationItemText as DefectText,
    DefectCodeCatalog,
    DefectCodeGroup,
    DefectCode,
    DefectCodeVersion,
    @ObjectModel.foreignKey.association: '_DefectLocationCatalog'
    cast( NotifItmObjectPartCodeCtlg as vdm_qfeocat preserving type )  as DefectLocationCatalog,
    @ObjectModel.foreignKey.association: '_DefectLocationCodeGroup'
    cast( NotifItmObjectPartCodeGroup as vdm_qfeogrp preserving type ) as DefectLocationCodeGroup,
    @ObjectModel.foreignKey.association: '_DefectLocationCode'
    cast( NotifItmObjectPartCode as vdm_qfeocod preserving type )      as DefectLocationCode,
//    NotifItmObjectPartVersion   as DefectLocationCodeVersion,

    DefectClass,
    NumberOfDefects,
    cast( '  ' as qdeflcyclestat preserving type ) as DefectLifecycleStatus,
    ReferencedDefect,
    
    _Notification.Plant,
    _Notification.Material,
    _Notification.Batch,
    _Notification.InspectionLot,
    InspPlanOperationInternalID,
    InspectionCharacteristic,
    InspectionSubsetInternalID,
    MaterialSample,
    
    _Notification.Supplier,
    _Notification.Customer,
    @ObjectModel.foreignKey.association: '_NotificationType'
    _Notification.NotificationType,

    // No order data in notification item so far

    cast( '            '   as vdm_qm_fertaufnr preserving type )  as ProductionOrder,
//    cast( '            '   as vdm_qm_fertaufnr preserving type )  as ManufacturingOrder,

    cast( '    '                      as vornr preserving type )  as ProductionOrderOperation, // External operation number

    cast( '      '                 as plnfolge preserving type )  as ProductionOrderSequence, // Sequence of operation


    _Notification.WorkCenterTypeCode,
    _Notification.MainWorkCenterInternalID,
    _Notification.MainWorkCenterPlant,
    MainWorkCenter,

//  No EWM related fields for items without referenced defect

    cast( '    ' as lgort_d preserving type )                        as StorageLocation,
    cast( '          ' as vdm_prvbe preserving type)                 as ProductionSupplyArea,
    cast( '    ' as /scwm/lgnum preserving type )                    as Warehouse,
    cast( '    ' as /scwm/ltap_vltyp preserving type )               as StorageType,
    cast( '                  ' as /scwm/ltap_vlpla preserving type ) as SourceStorageBin,
    cast( '          ' as qfewm_wrhslgclsyst preserving type )       as WarehouseLogicalSystem,
    
    I_NotificationItem.IsDeleted,
    I_NotificationItem.DefectOrigin,
    cast( '  ' as qdefectcausedby preserving type ) as DefectCausedBy,
    DefectUUID,
    
    _Notification,
    _NotificationType,
    _DefectCategory,
    _DefectCodeGroup,
    _DefectCode,
    _DefectLocationCatalog,
    _DefectLocationCodeGroup,
    _DefectLocationCode,
    _DefectClass,
    _DefectStatus,
    _DefectCausedBy,
    _Notification._Plant,
    _Notification._Product,
    _InspectionLot,
    _EWM_WarehouseNumber_2,
    @VDM.lifecycle: { status: #DEPRECATED, successor: '_EWM_WarehouseNumber_2' }
    _EWM_WarehouseNumber,
    _CreatedByUserContactCard,
    _LastChangedByUserContactCard

} where //select only notification items

        DefectCategory = ''
        //and only from quality notifications

        and ( _Notification.NotificationOrigin = 'Q1' or _Notification.NotificationOrigin = 'Q2' or _Notification.NotificationOrigin = 'Q3' )
        //and only those that have the new ID assigned

        and DefectInternalID <> ''
        //and without referenced defect

        and ReferencedDefect = '' 
        and IsDeleted <> 'X'
        and _Notification.NotifProcessingPhase <> '5'