@AbapCatalog.sqlViewName: 'PPPMFGORDDOCOBJL'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@ClientHandling.algorithm: #SESSION_VARIABLE@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #L, dataClass: #MIXED}@VDM.lifecycle.contract.type: #NONE@VDM.viewType: #COMPOSITE@VDM.private: truedefineview P_MfgOrderDocInfoRecdObjLink
asselectfrom P_MfgOrdLinkedSAPObjKeyRnge as ord
innerjoin I_DocumentInfoRecordObjectLink as link on link.LinkedSAPObjectKey between ord.LinkedSAPObjectKeyLow and ord.LinkedSAPObjectKeyHigh
innerjoin I_DocumentInfoRecord as docu on link.DocumentInfoRecordDocType = docu.DocumentInfoRecordDocType
and link.DocumentInfoRecordDocNumber = docu.DocumentInfoRecordDocNumber
and link.DocumentInfoRecordDocPart = docu.DocumentInfoRecordDocPart
and link.DocumentInfoRecordDocVersion = docu.DocumentInfoRecordDocVersion
association [1..1] to I_ManufacturingOrder as _MfgOrder on $projection.ManufacturingOrder = _MfgOrder.ManufacturingOrder
association [1..1] to I_DocumentInfoRecordDocType as _DocumentType on $projection.DocumentType = _DocumentType.DocumentInfoRecordDocType
association [1..1] to I_DocumentInfoRecordDocNumber as _DocumentNumber on $projection.DocumentType = _DocumentNumber.DocumentInfoRecordDocType
and $projection.DocumentInfoRecord = _DocumentNumber.DocumentInfoRecordDocNumber
association [1..1] to I_DocumentInfoRecordDocVersion as _DocumentVersion on $projection.DocumentType = _DocumentVersion.DocumentInfoRecordDocType
and $projection.DocumentInfoRecord = _DocumentVersion.DocumentInfoRecordDocNumber
and $projection.DocumentVersion = _DocumentVersion.DocumentInfoRecordDocVersion
association [1..1] to I_DocumentInfoRecordDocPrt as _DocumentPart on $projection.DocumentType = _DocumentPart.DocumentInfoRecordDocType
and $projection.DocumentInfoRecord = _DocumentPart.DocumentInfoRecordDocNumber
and $projection.DocumentVersion = _DocumentPart.DocumentInfoRecordDocVersion
and $projection.DocumentPart = _DocumentPart.DocumentInfoRecordDocPart
association [0..1] to I_DocumentInfoRecordDocStatus as _DocumentStatus on $projection.DocumentType = _DocumentStatus.DocumentInfoRecordDocType
and $projection.InternalDocumentStatus = _DocumentStatus.InternalDocumentStatus
association [0..*] to I_DocumentInfoRecordDesc as _DocumentText on $projection.DocumentType = _DocumentText.DocumentInfoRecordDocType
and $projection.DocumentInfoRecord = _DocumentText.DocumentInfoRecordDocNumber
and $projection.DocumentVersion = _DocumentText.DocumentInfoRecordDocVersion
and $projection.DocumentPart = _DocumentText.DocumentInfoRecordDocPart
association [0..1] to I_ChangeMaster as _ChangeNumber on $projection.ChangeNumber = _ChangeNumber.ChangeNumber
association [0..1] to I_User as _CreatedUser on $projection.CreatedByUser = _CreatedUser.UserID
association [0..1] to I_User as _ChangedUser on $projection.LastChangedByUser = _ChangedUser.UserID
{
key link.LinkedSAPObjectKey as LinkedSAPObjectKey,
key link.LinkedSAPObject as LinkedSAPObject,
key link.DocumentInfoRecordDocType as DocumentType,
key link.DocumentInfoRecordDocNumber as DocumentInfoRecord,
key link.DocumentInfoRecordDocPart as DocumentPart,
key link.DocumentInfoRecordDocVersion as DocumentVersion,
// Administrative Data
link.CreationDateTime,
link.CreatedByUser,
link.ChangedDateTime,
link.LastChangedByUser,
// Document Data
docu.InternalDocumentStatus,
docu.ChangeNumber,
docu.AuthorizationGroup,
docu.ResponsiblePersonName,
docu.LaboratoryOrDesignOffice,
docu.Plant,
// Miscellaneous Data
link.DocInfoRecdLinkStatus,
link.DocInfoRecdObjectLinkStatus,
link.ObjectTypeDatabaseTable,
@Semantics.booleanIndicatorcase link.DocLinkDirectionIsActive
when '' then ''
else 'X'
endas DocLinkDirectionIsActive,
link.IsDefaultDocument,
@Semantics.booleanIndicator
link.DocInfoRecdIsMarkedForDeletion,
// build substrings for I_ view
ord.ManufacturingOrder as ManufacturingOrder,
substring(link.LinkedSAPObjectKey, 13, 1) as MfgOrderLinkedObjType,
substring(link.LinkedSAPObjectKey, 14, 4) as ManufacturingOrderItem,
substring(link.LinkedSAPObjectKey, 18, 6) as ManufacturingOrderSequence,
substring(link.LinkedSAPObjectKey, 24, 4) as ManufacturingOrderOperation,
substring(link.LinkedSAPObjectKey, 28, 8) as OrderOperationInternalID,
-- substring(link.LinkedSAPObjectKey, 36, 4) as DocObjectLinkCounter
substring(link.LinkedSAPObjectKey, 40, 1) as OpActyNtwkSegmentType,
substring(link.LinkedSAPObjectKey, 41,10) as OpActyNtwkElementExternalID,
substring(link.LinkedSAPObjectKey, 51,18) as SerialNumber,
//Order Data
ord.ManufacturingOrderCategory,
ord.ManufacturingOrderType,
// Associations
_MfgOrder,
_DocumentType,
_DocumentNumber,
_DocumentVersion,
_DocumentPart,
_DocumentStatus,
_DocumentText,
_CreatedUser,
_ChangedUser,
_ChangeNumber,
ord._MfgOrderCategory,
ord._MfgOrderType,
link._DocumentInfoRecordDesc as _Text
}
where
link.LinkedSAPObject = 'PORDER'; // only prod. orders
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_DOCUMENTINFORECORD",
"I_DOCUMENTINFORECORDOBJECTLINK",
"P_MFGORDLINKEDSAPOBJKEYRNGE"
],
"ASSOCIATED":
[
"I_CHANGEMASTER",
"I_DOCUMENTINFORECORDDESC",
"I_DOCUMENTINFORECORDDOCNUMBER",
"I_DOCUMENTINFORECORDDOCPRT",
"I_DOCUMENTINFORECORDDOCSTATUS",
"I_DOCUMENTINFORECORDDOCTYPE",
"I_DOCUMENTINFORECORDDOCVERSION",
"I_MANUFACTURINGORDER",
"I_MFGORDERCATEGORY",
"I_MFGORDERTYPE",
"I_USER"
],
"BASE":
[
"I_DOCUMENTINFORECORDOBJECTLINK",
"P_MFGORDLINKEDSAPOBJKEYRNGE"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/