P_MfgDefectHistory is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_NotificationItem) and exposes 27 fields with key fields Notification, NotificationItem.
@AbapCatalog.sqlViewName: 'PMFGDEFECTHIST'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.viewType: #COMPOSITE@VDM.private: true@ObjectModel.usageType.serviceQuality: #C@ObjectModel.usageType.sizeCategory: #M@ObjectModel.usageType.dataClass: #MIXED@ClientHandling.algorithm: #SESSION_VARIABLEdefineview P_MfgDefectHistory
asselectfrom I_NotificationItem as NotificationItem
leftouter to one join I_Notification as Notification on NotificationItem.Notification = Notification.Notification
leftouter to one join I_NotificationItem as NotificationItemRef on NotificationItemRef.Notification = NotificationItem.ReferencedDefect
{
key NotificationItem.Notification,
key NotificationItem.NotificationItem,
keycasewhen NotificationItem.ReferencedDefect isnot initial
thencast( substring(NotificationItem.ReferencedDefect,2,11) as qdefectid preserving type )
when NotificationItem.DefectCategory isnot initial
thencast( substring(NotificationItem.Notification,2,11) as qdefectid preserving type )
else ''
endas Defect,
length(NotificationItem.Notification) as NotificationFieldLengthValue,
NotificationItem.DefectCategory,
@ObjectModel: { foreignKey.association: '_CreatedByUserContactCard' }
NotificationItem.CreatedByUser,
NotificationItem.CreationDate,
@ObjectModel: { foreignKey.association: '_LastChangedByUserContactCard' }
NotificationItem.LastChangedByUser,
NotificationItem.LastChangeDate,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.ProductionOrderOperationActy
else
NotificationItem.ProductionOrderOperationActy
endas ProductionOrderOperationActy,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.ProductionOrderOpActyVers
else
NotificationItem.ProductionOrderOpActyVers
endas ProductionOrderOpActyVers,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.ProductionOrder
when NotificationItem.InspectionCharacteristic isnot initial
thencast( Notification.ProductionOrder as vdm_qm_fertaufnr preserving type )
elsecast( NotificationItem.ProductionOrder as vdm_qm_fertaufnr preserving type )
endas ProductionOrder,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.OrderInternalID
when NotificationItem.InspectionCharacteristic isnot initial
then Notification.MfgOrderInternalID
else
NotificationItem.OrderInternalID
endas OrderInternalID,
@Semantics.time: truecast( NotificationItem.CreationTime as vdm_qerstezeit preserving type ) as CreationTime,
@Semantics.time: truecast( NotificationItem.LastChangeTime as vdm_qaendezeit preserving type ) as LastChangeTime,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.InspPlanOperationInternalID
else
NotificationItem.InspPlanOperationInternalID
endas InspPlanOperationInternalID,
NotificationItem.InspectionSubsetInternalID,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.Equipment
else
NotificationItem.Equipment
endas Equipment,
@Semantics.booleanIndicator: truecast( NotificationItem.IsDeleted as vdm_qdefisdeleted preserving type ) as IsDeleted,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.ProducedMaterial
when NotificationItem.InspectionCharacteristic isnot initial
thencast( Notification.Material as vdm_defective_material preserving type )
else
NotificationItem.ProducedMaterial
endas Material,
casewhen NotificationItem.Plant is initial
then Notification.Plant
else
NotificationItem.Plant
endas Plant,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.InspectionLot
when NotificationItem.InspectionCharacteristic isnot initial
then Notification.InspectionLot
else
NotificationItem.InspectionLot
endas InspectionLot,
NotificationItem.ChangedDateTime,
NotificationItem.Notification as DefectInternalID,
NotificationItem.NotificationItemText,
NotificationItem.MainWorkCenter,
NotificationItem.MainWorkCenterPlant,
casewhen NotificationItem.ReferencedDefect isnot initial
then NotificationItemRef.ProducedSerialNumber
when NotificationItem.DefectCategory isnot initial
then NotificationItem.ProducedSerialNumber
endas SerialNumber,
NotificationItem.InspectionCharacteristic,
/* Associations */
NotificationItem._CreatedByUserContactCard,
NotificationItem._LastChangedByUserContactCard,
NotificationItem._DefectCategory
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_NOTIFICATION",
"I_NOTIFICATIONITEM"
],
"ASSOCIATED":
[
"I_DEFECTCATEGORY",
"I_USERCONTACTCARD"
],
"BASE":
[
"I_NOTIFICATIONITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/