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.
Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view P_MfgDefectHistory.-- Reconstructed from parsed metadata (data sources, associations, fields).-- SAP annotations are omitted and the structure is reformulated as SQL;-- this is a functional approximation, not the verbatim SAP source. Some join-- conditions may be unavailable and a few CDS constructs are kept as-is.-- SQL view name: PMFGDEFECTHISTCREATE VIEW P_MfgDefectHistory ASSELECT
NotificationItem.Notification AS Notification,
NotificationItem.NotificationItem AS NotificationItem,
length(NotificationItem.Notification) AS NotificationFieldLengthValue,
NotificationItem.DefectCategory AS DefectCategory,
NotificationItem.CreatedByUser AS CreatedByUser,
NotificationItem.CreationDate AS CreationDate,
NotificationItem.LastChangedByUser AS LastChangedByUser,
NotificationItem.LastChangeDate AS LastChangeDate,
casewhen NotificationItem.ReferencedDefect isnot initial then NotificationItemRef.OrderInternalID when NotificationItem.InspectionCharacteristic isnot initial then Notification.MfgOrderInternalID else NotificationItem.OrderInternalID endas OrderInternalID AS OrderInternalIDendasOrderInternalID,
cast( NotificationItem.CreationTime as vdm_qerstezeit preserving type ) AS CreationTime,
cast( NotificationItem.LastChangeTime as vdm_qaendezeit preserving type ) AS LastChangeTime,
NotificationItem.InspectionSubsetInternalID AS InspectionSubsetInternalID,
casewhen NotificationItem.ReferencedDefect isnot initial then NotificationItemRef.Equipment else NotificationItem.Equipment endas Equipment AS EquipmentendasEquipment,
cast( 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 AS ProducedMaterialendasMaterial,
casewhen NotificationItem.Plant is initial then Notification.Plant else NotificationItem.Plant endas Plant AS PlantendasPlant,
casewhen NotificationItem.ReferencedDefect isnot initial then NotificationItemRef.InspectionLot when NotificationItem.InspectionCharacteristic isnot initial then Notification.InspectionLot else NotificationItem.InspectionLot endas InspectionLot AS InspectionLotendasInspectionLot,
NotificationItem.ChangedDateTime AS ChangedDateTime,
NotificationItem.Notification AS DefectInternalID,
NotificationItem.NotificationItemText AS NotificationItemText,
NotificationItem.MainWorkCenter AS MainWorkCenter,
NotificationItem.MainWorkCenterPlant AS MainWorkCenterPlant,
casewhen NotificationItem.ReferencedDefect isnot initial then NotificationItemRef.ProducedSerialNumber when NotificationItem.DefectCategory isnot initial then NotificationItem.ProducedSerialNumber endas SerialNumber AS ProducedSerialNumberendasSerialNumber,
NotificationItem.InspectionCharacteristic AS InspectionCharacteristic,
NotificationItem._CreatedByUserContactCard AS _CreatedByUserContactCard,
NotificationItem._LastChangedByUserContactCard AS _LastChangedByUserContactCard,
NotificationItem._DefectCategory AS _DefectCategory
FROM I_NotificationItem AS NotificationItem
;