@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AccessControl.privilegedAssociations: ['_CreatedUser', '_ChangedUser']
@Analytics.dataCategory: #FACT
@Analytics.technicalName: 'IMFGORDERDOCLINK'
@Analytics.dataExtraction.enabled: true
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.modelingPattern: #NONE
@ObjectModel.supportedCapabilities: [#CDS_MODELING_DATA_SOURCE, #EXTRACTION_DATA_SOURCE, #SQL_DATA_SOURCE]
@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #L, dataClass: #MIXED}
@VDM.lifecycle.contract.type: #PUBLIC_LOCAL_API
@VDM.viewType: #COMPOSITE
@EndUserText.label: 'Manufacturing Order Document Link'
// CDS view for all document links attached to either manufacturing order header or operations.
/*+[hideWarning] { "IDS" : [ "KEY_CHECK" ] } */
define view entity I_MfgOrderDocumentLink
as select from P_MfgOrderDocInfoRecdObjLink as docl
association [0..1] to I_ManufacturingOrderSequence as _MfgOrderSequence on $projection.ManufacturingOrder = _MfgOrderSequence.ManufacturingOrder
and $projection.ManufacturingOrderSequence = _MfgOrderSequence.ManufacturingOrderSequence
association [0..1] to I_MfgOrderOperationBySemKey as _MfgOrderOperation on $projection.ManufacturingOrder = _MfgOrderOperation.ManufacturingOrder
and $projection.ManufacturingOrderSequence = _MfgOrderOperation.ManufacturingOrderSequence
and $projection.ManufacturingOrderOperation = _MfgOrderOperation.ManufacturingOrderOperation
-- to child: Original
association [0..*] to I_MfgOrderDocumentLinkOriginal as _DocumentOriginal on $projection.DocumentType = _DocumentOriginal.DocumentInfoRecordDocType
and $projection.DocumentPart = _DocumentOriginal.DocumentInfoRecordDocPart
and $projection.DocumentInfoRecord = _DocumentOriginal.DocumentInfoRecordDocNumber
and $projection.DocumentVersion = _DocumentOriginal.DocumentInfoRecordDocVersion
{
// Key
key docl.LinkedSAPObjectKey as LinkedSAPObjectKey,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_DocInfoRecdDocTypeStdVH', element: 'DocumentInfoRecordDocType' } } ]
@ObjectModel.foreignKey.association: '_DocumentType'
key docl.DocumentType as DocumentType,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_DocInfoRecdDocNmbrStdVH', element: 'DocumentInfoRecordDocNumber' } } ]
@ObjectModel.foreignKey.association: '_DocumentNumber'
key docl.DocumentInfoRecord as DocumentInfoRecord,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_DocInfoRecdDocPrtStdVH', element: 'DocumentInfoRecordDocPart' } } ]
@ObjectModel.foreignKey.association: '_DocumentPart'
key cast(docl.DocumentPart as pph_doktl preserving type) as DocumentPart,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_DocInfoRecdDocVersStdVH', element: 'DocumentInfoRecordDocVersion' } } ]
@ObjectModel.foreignKey.association: '_DocumentVersion'
key cast(docl.DocumentVersion as pph_dokvr preserving type) as DocumentVersion,
// Administrative Data
@Semantics.systemDateTime.createdAt: true
cast(docl.CreationDateTime as hp_created_at preserving type) as CreationDateTime,
@Semantics.user.createdBy: true
cast(docl.CreatedByUser as ernam preserving type) as CreatedByUser,
@Semantics.systemDateTime.lastChangedAt: true
cast(docl.ChangedDateTime as hp_changed_at preserving type) as ChangedDateTime,
@Semantics.user.lastChangedBy: true
cast(docl.LastChangedByUser as aenam preserving type) as LastChangedByUser,
// Mfg Order Data
cast(docl.MfgOrderLinkedObjType as pord_doclt preserving type) as MfgOrderLinkedObjType,
@ObjectModel.foreignKey.association: '_MfgOrderCategory'
docl.ManufacturingOrderCategory,
@ObjectModel.foreignKey.association: '_MfgOrderType'
cast(docl.ManufacturingOrderType as aufart preserving type) as ManufacturingOrderType,
@Consumption.valueHelpDefinition: [ { entity: { name: 'I_MfgOrderStdVH', element: 'ManufacturingOrder' } } ]
@ObjectModel.foreignKey.association: '_MfgOrder'
cast(docl.ManufacturingOrder as co_aufnr preserving type) as ManufacturingOrder,
@ObjectModel.foreignKey.association: '_MfgOrderSequence'
cast(docl.ManufacturingOrderSequence as plnfolge preserving type) as ManufacturingOrderSequence,
@ObjectModel.foreignKey.association: '_MfgOrderOperation'
cast(docl.ManufacturingOrderOperation as vdm_vornr preserving type) as ManufacturingOrderOperation,
// Document Data
@ObjectModel.foreignKey.association: '_DocumentStatus'
docl.InternalDocumentStatus,
@ObjectModel.foreignKey.association: '_ChangeNumber'
docl.ChangeNumber,
-- @Semantics.user.responsible: true
cast(docl.ResponsiblePersonName as pph_dwnam preserving type) as ResponsiblePersonName,
// Associations
@ObjectModel.association.type: [#TO_COMPOSITION_ROOT, #TO_COMPOSITION_PARENT]
docl._MfgOrder,
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
_DocumentOriginal,
_MfgOrderSequence,
_MfgOrderOperation,
docl._MfgOrderCategory,
docl._MfgOrderType,
docl._DocumentNumber,
docl._DocumentType,
docl._DocumentVersion,
docl._DocumentPart,
docl._DocumentStatus,
docl._DocumentText,
docl._ChangeNumber,
docl._CreatedUser,
docl._ChangedUser
} where
docl.MfgOrderLinkedObjType = 'H' or // header
docl.MfgOrderLinkedObjType = 'O'; // operation
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_MFGORDERDOCINFORECDOBJLINK"
],
"ASSOCIATED":
[
"I_CHANGEMASTER",
"I_DOCUMENTINFORECORDDESC",
"I_DOCUMENTINFORECORDDOCNUMBER",
"I_DOCUMENTINFORECORDDOCPRT",
"I_DOCUMENTINFORECORDDOCSTATUS",
"I_DOCUMENTINFORECORDDOCTYPE",
"I_DOCUMENTINFORECORDDOCVERSION",
"I_MANUFACTURINGORDER",
"I_MANUFACTURINGORDERSEQUENCE",
"I_MFGORDERCATEGORY",
"I_MFGORDERDOCUMENTLINKORIGINAL",
"I_MFGORDEROPERATIONBYSEMKEY",
"I_MFGORDERTYPE",
"I_USER"
],
"BASE":
[
"P_MFGORDERDOCINFORECDOBJLINK"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/