@AccessControl.authorizationCheck: #NOT_REQUIRED
@AccessControl.personalData.blocking: #REQUIRED
@EndUserText.label: 'Process Order Item'
@VDM.private:true
@Search.searchable: false
@ObjectModel: {
usageType : { serviceQuality: #C, sizeCategory: #XXL, dataClass: #MIXED }
}
@VDM.viewType: #CONSUMPTION
@Metadata.allowExtensions: false
@Metadata.ignorePropagatedAnnotations: true
define view entity P_MPEProcOrderItemPover
as select from I_MfgOrder as mfgorder
inner join I_ManufacturingOrderItem as Item on mfgorder.ManufacturingOrder = Item.ManufacturingOrder
association [0..1] to I_WBSElement as _WBSElement2 on $projection.WBSElementInternalID = _WBSElement2.WBSElementInternalID
association [0..1] to P_MPEProdnOrdItmDvtnDurn as _OrdData on $projection.ManufacturingOrder = _OrdData.ManufacturingOrder
association [0..1] to I_StatusCodeText as _StatusText on $projection.orderstatus = _StatusText.StatusCode
and _StatusText.StatusProfile = ''
and _StatusText.Language = $session.system_language
association [0..1] to I_MfgOrder as _LeadingMfgOrder on $projection.LeadingOrder = _LeadingMfgOrder.ManufacturingOrder
{
@Search: {defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.8}
key mfgorder.ManufacturingOrder,
key Item.ManufacturingOrderItem,
//Bill of Operations
@UI.hidden: true
mfgorder.OrderInternalBillOfOperations,
//Manufactoring Order Category
@UI.hidden: true
mfgorder.ManufacturingOrderCategory,
//Production Plant
@UI.hidden: true
Item.ProductionPlant,
//Material
Item.Material,
//Material Description
@Semantics.text
Item._Material._Text[1: Language = $session.system_language].MaterialName,
//Order Status
_OrdData.OrderStatus,
//Milestone Status
case
when _OrdData.OrderStatus = 'I0013' then '' // => DELETED
when _OrdData.OrderStatus = 'I0076' then '' // => MARKED FOR DELETION
when _OrdData.OrderStatus = 'I0045' then '' // => TECHNICALLY COMPLETED
when _OrdData.OrderStatus = 'I0046' then '' // => CLOSED
// => DELIVERED
when _OrdData.OrderStatus = 'I0012' and _OrdData.PlannedActualDlvDvtnDurn <= 0 then 'DELV' // 'Delivered'
when _OrdData.OrderStatus = 'I0012' and _OrdData.PlannedActualDlvDvtnDurn > 0 then 'DELD' // 'Delivered - Delayed'
when _OrdData.OrderStatus = 'I0012' and _OrdData.PlannedActualDlvDvtnDurn is null then 'DELD' // 'Delivered - Delayed'
when _OrdData.PlannedCurrentAvailDvtnDurn > 0 then 'DELO' // 'part. Delivered - Overdue/ Delivered - Overdue'
// => partially DELIVERED
when _OrdData.OrderStatus = 'I0074' and _OrdData.PlannedCurrentAvailDvtnDurn <= 0 and _OrdData.OrderIsConfirmed = '' then 'INPR' // 'partially Delivery - in Progress'
when _OrdData.OrderStatus = 'I0074' and _OrdData.PlannedCurrentAvailDvtnDurn <= 0 and _OrdData.OrderIsConfirmed = 'X' then 'CMPL' // 'Confirmed-Completed' => partially delivery has not started until now
when _OrdData.OrderStatus = 'I0074' and _OrdData.PlannedCurrentAvailDvtnDurn <= 0 then 'NULL' // 'Teststatus'
// => CONFIRMED
when _OrdData.OrderStatus = 'I0009' and _OrdData.PlannedActualEndDvtnDurn <= 0 then 'CMPL' // 'Confirmed-Completed'
when _OrdData.OrderStatus = 'I0009' and _OrdData.PlannedActualEndDvtnDurn > 0 then 'CMPD' // 'Confirmed-Completed Delayed'
when _OrdData.OrderStatus = 'I0009' and _OrdData.PlannedActualEndDvtnDurn is null then 'CMPD' // 'Confirmed-Completed Delayed'
when _OrdData.PlannedCurrentEndDvtnDurn > 0 then 'ENDO' // 'Confirmed-End Overdue'
// => PARTIALLY CONFIRMED
when _OrdData.OrderStatus = 'I0010' and _OrdData.PlannedActualStartDateDvtnDurn <= 0 then 'INPR' // 'Partially Confirmed - In Progress'
when _OrdData.OrderStatus = 'I0010' and _OrdData.PlannedActualStartDateDvtnDurn > 0 then 'INPD' // 'Partially Confirmed - In Progress Delayed'
when _OrdData.OrderStatus = 'I0010' and _OrdData.PlannedActualStartDateDvtnDurn is null then 'INPD' // 'Partially Confirmed - In Progress Delayed'
when _OrdData.PlannedCurrentStrtDateDvtnDurn > 0 then 'STOV' // 'Partially Confirmed - Start Overdue'
// => RELEASED
when _OrdData.OrderStatus = 'I0002' and _OrdData.PlannedActlReleaseDateDvtnDurn <= 0 then 'RELE' // 'Released'
when _OrdData.OrderStatus = 'I0002' and _OrdData.PlannedActlReleaseDateDvtnDurn > 0 then 'RELD' // 'Released - Delayed'
when _OrdData.OrderStatus = 'I0002' and _OrdData.PlannedActlReleaseDateDvtnDurn is null then 'RELD' // 'Released - Delayed'
// => PARTIALLY RELEASED
when _OrdData.OrderStatus = 'I0042' and _OrdData.PlannedActlReleaseDateDvtnDurn <= 0 then 'RELE' // 'Partially Released'
when _OrdData.OrderStatus = 'I0042' and _OrdData.PlannedActlReleaseDateDvtnDurn > 0 then 'RELD' // 'Partially Released - Delayed'
when _OrdData.OrderStatus = 'I0042' and _OrdData.PlannedActlReleaseDateDvtnDurn is null then 'RELD' // 'Partially Released - Delayed'
when _OrdData.PlannedCurrReleaseDateDvtnDurn > 0 then 'RELO' // 'Partially Released - Overdue'
when _OrdData.OrderStatus = 'I0001' then 'CREA' // => CREATED
// when _OrdData.OrderStatus = 'I0074' then 'CMPL' // 'Confirmed-Completed' => JUST IN TIME,
else ''
end as ProductionMilestoneStatus,
//Order Priority
mfgorder.ManufacturingOrderImportance,
//Order Type
mfgorder.ManufacturingOrderType,
//Order Type Description
@Semantics.text
mfgorder._MfgOrderType._Text[1: Language = $session.system_language].ManufacturingOrderTypeName,
//Scheduled Release Date
mfgorder.MfgOrderScheduledReleaseDate,
//Scheduled Start Date
mfgorder.MfgOrderScheduledStartDate,
//Scheduled End Date
mfgorder.MfgOrderScheduledEndDate,
//Scheduled Release Time => NOT AVAILABLE IN PRODUCTION ORDER <=
//Basic Start Date
mfgorder.MfgOrderPlannedStartDate,
//Basic Start Time
mfgorder.MfgOrderPlannedStartTime,
//Basic End Date
mfgorder.MfgOrderPlannedEndDate,
//Basic End Time
mfgorder.MfgOrderPlannedEndTime,
//Actual Starte Date
mfgorder.MfgOrderActualStartDate,
//Actual Start Time
mfgorder.MfgOrderActualStartTime,
//Actual End Date
mfgorder.MfgOrderActualEndDate,
//Actual End Time => NOT AVAILABLE IN PRODUCTION ORDER <=
//Goods receipt processing time in days
_OrdData.MaterialGoodsReceiptDuration,
//Unit of Measure on Header Level
//@Semantics.unitOfMeasure: true
mfgorder.ProductionUnit,
Item.ProductionUnit as MfgOrderItemProductionUnit,
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
//Order Quantity
mfgorder.MfgOrderPlannedTotalQty,
@Semantics.quantity.unitOfMeasure: 'MfgOrderItemProductionUnit'
Item.MfgOrderItemPlannedTotalQty,
//Scrap Quantity
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
mfgorder.MfgOrderPlannedScrapQty,
@Semantics.quantity.unitOfMeasure: 'MfgOrderItemProductionUnit'
Item.MfgOrderItemPlannedScrapQty,
//Goods Receipt Quantity
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
mfgorder.ActualDeliveredQuantity,
@Semantics.quantity.unitOfMeasure: 'MfgOrderItemProductionUnit'
Item.MfgOrderItemGoodsReceiptQty,
//Expected Deviation Quantity
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
mfgorder.ExpectedDeviationQuantity * (-1) as ExpectedDeviationQuantity,
// @Semantics.quantity.unitOfMeasure: 'ProductionUnit'
// case
// when mfgorder.IsCompletelyDelivered = 'X'
// then mfgorder.MfgOrderPlannedTotalQty * 0
// else mfgorder.MfgOrderPlannedTotalQty - mfgorder.MfgOrderPlannedScrapQty - mfgorder.ActualDeliveredQuantity - mfgorder.ExpectedDeviationQuantity
// end as OpenQuantity,
@Semantics.quantity.unitOfMeasure: 'MfgOrderItemProductionUnit'
case
when Item.IsCompletelyDelivered = 'X'
then Item.MfgOrderItemPlannedTotalQty * 0
else Item.MfgOrderItemPlannedTotalQty - Item.MfgOrderItemPlannedScrapQty - Item.MfgOrderItemActualDeviationQty - Item.MfgOrderItemActualDeviationQty
end as OpenQuantity,
//Delivery Completed Indicator
Item.IsCompletelyDelivered,
//Product Version
Item.ProductionVersion,
//Product Version Description
@Semantics.text
Item._ProductionVersion.ProductionVersionText,
//Production Version Plant
@UI.hidden: true
Item._ProductionVersion.Plant,
//Production Line
mfgorder._ProductionVersion.ProductionLine,
//Production Line Description
@Semantics.text
mfgorder._ProductionVersion._ProductionLine._WorkCenterTextBySemanticKey[ 1: Language = $session.system_language ].WorkCenterText,
//Order Start is late
case
when _OrdData.OrderIsPartiallyConfirmed= 'X' and _OrdData.ConfirmedStartDelayInSeconds > 0 then 'X'
when (_OrdData.OrderIsReleased= 'X' and _OrdData.OrderIsConfirmed= '') and _OrdData.CurrentStartDelayInSeconds > 0 then 'X'
else ''
end as OrderExecutionStartIsLate,
//Order End is late
case
when _OrdData.OrderIsConfirmed= 'X' and _OrdData.ConfirmedEndDelayInSeconds > 0 then 'X'
when (_OrdData.OrderIsPartiallyConfirmed= 'X' and _OrdData.OrderIsConfirmed = '') and _OrdData.CurrentEndDelayInSeconds > 0 then 'X'
else ''
end as OrderExecutionEndIsLate,
//MRP Plant
@UI.hidden: true
mfgorder.MRPPlant,
//MRP Controller
mfgorder.MRPController,
//MRP Controller Description
@Semantics.text
mfgorder._MRPController.MRPControllerName,
//Production Supervisor
Item.ProductionSupervisor,
//Production Supervisor Description
@Semantics.text
mfgorder._ProductionSupervisor.ProductionSupervisorName,
//Leading Order Material
_LeadingMfgOrder.Material as LeadingMfgOrderMaterial,
//Leading Order Material Name
_LeadingMfgOrder._Material._Text[1: Language = $session.system_language].MaterialName as LeadingMfgOrderMaterialName,
//Leading Order
mfgorder.LeadingOrder,
//Sales Document (follow-up Document should be a SD Order, if available)
mfgorder.SalesDocument as SlsDoc,
//Sales Document (further data to find the follow-up document)
mfgorder.SalesDocumentItem as SlsDocItm,
//Sales Document Category (further data to find the follow-up document)
mfgorder._SalesDocumentItem.SDDocumentCategory as SlsDocCat,
//Sales Document Category Description
@Semantics.text
mfgorder._SalesDocumentItem._SDDocumentCategory._Text[1: Language = $session.system_language].SDDocumentCategoryName as SlsDocCatName,
//If follow-up document is not available take the actual document
coalesce( mfgorder._SalesDocumentItem.SalesDocument, mfgorder.SalesOrder ) as SDDocument,
//If follow-up document is not available take the actual document
coalesce( mfgorder._SalesDocumentItem.SalesDocumentItem, mfgorder.SalesOrderItem ) as SDDocumentItem,
//If follow-up document is not available take the actual document
coalesce( mfgorder._SalesDocumentItem.SDDocumentCategory, mfgorder._SalesDocumentItem.SDDocumentCategory ) as SDDocumentCategory,
//If follow-up document is not available take the actual document
@Semantics.text
coalesce( mfgorder._SalesDocumentItem._SDDocumentCategory._Text[1: Language = $session.system_language].SDDocumentCategoryName, mfgorder._SalesDocumentItem._SDDocumentCategory._Text[1: Language = $session.system_language].SDDocumentCategoryName ) as SDDocumentCategoryName,
//Reference Document which is needed to find the follow-up document (Quotation)
mfgorder.SalesOrder as ReferenceSDDocument,
//Reference Document which is needed to find the follow-up document (Quotation Item)
mfgorder.SalesOrderItem as ReferenceSDDocumentItem,
//Customer (Sold-to Party)
mfgorder._SalesDocument.SoldToParty,
//Customer (Sold-to Party) Name
@Semantics.text
mfgorder._SalesDocument._SoldToParty.CustomerName,
//Authority Check for Customer (Sold-to Party)
mfgorder._SalesDocument._SoldToParty.AuthorizationGroup,
//WBS Element
mfgorder._WBSElement.WBSElement,
//Element Description
@Semantics.text
mfgorder._WBSElement.WBSDescription,
cast( case
when mfgorder._WBSElement.ResponsiblePerson = '00000000' or mfgorder._WBSElement.ResponsiblePerson is null
then _WBSElement2._EntProjectResponsiblePerson.PersonWorkAgreement
else
mfgorder._WBSElement.ResponsiblePerson
end as ps_s4_vernr preserving type ) as ProjectResponsiblePerson,
cast( case
when mfgorder._WBSElement.ResponsiblePerson = '00000000' or mfgorder._WBSElement.ResponsiblePerson is null
then _WBSElement2._EntProjectResponsiblePerson._WorkforcePerson.PersonFullName
else
mfgorder._WBSElement.ResponsiblePersonName
end as ad_namtext preserving type ) as ProjectResponsiblePersonName,
//Project
mfgorder._WBSElement._Project.Project,
//Project Description
@Semantics.text
//To use the language key leads to errors in this case
mfgorder._WBSElement._Project.ProjectDescription,
//Inspection Lot
mfgorder.InspectionLot,
case
when mfgorder.LastChangeDate = '00000000'
then dats_tims_to_tstmp( mfgorder.MfgOrderCreationDate, mfgorder.MfgOrderCreationTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL' )
else dats_tims_to_tstmp( mfgorder.LastChangeDate, mfgorder.LastChangeTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL' )
end as LastChangeDateTime,
//Associations
mfgorder._OrdInternalBillOfOperations,
mfgorder._MfgOrderCategory,
Item._Material,
_StatusText,
mfgorder._MfgOrderType,
Item._ProductionVersion,
Item._ProductionPlant,
mfgorder._MRPPlant,
mfgorder._MRPController,
_WBSElement2,
Item._ProductionSupervisor,
mfgorder.WBSElementInternalID,
mfgorder._SalesDocument._SoldToParty
}
where
mfgorder.ManufacturingOrderCategory = '40'; //Process Orders
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CUSTOMER",
"I_ENTPROJECTRESPONSIBLEPERSON",
"I_MANUFACTURINGORDERITEM",
"I_MATERIAL",
"I_MATERIALTEXT",
"I_MFGORDER",
"I_MFGORDERTYPE",
"I_MFGORDERTYPETEXT",
"I_MRPCONTROLLER",
"I_PRODUCTIONLINE",
"I_PRODUCTIONSUPERVISOR",
"I_PRODUCTIONVERSION",
"I_PROJECTBYINTERNALKEY",
"I_SALESDOCUMENT",
"I_SALESDOCUMENTITEM",
"I_SDDOCUMENTCATEGORY",
"I_SDDOCUMENTCATEGORYTEXT",
"I_WBSELEMENT",
"I_WBSELEMENTBYINTERNALKEY",
"I_WORKCENTERTEXTBYSEMANTICKEY",
"I_WORKFORCEPERSON",
"P_MPEPRODNORDITMDVTNDURN"
],
"ASSOCIATED":
[
"I_CUSTOMER",
"I_MATERIAL",
"I_MFGORDERCATEGORY",
"I_MFGORDERTYPE",
"I_MRPCONTROLLER",
"I_ORDINTERNALBILLOFOPERATIONS",
"I_PLANT",
"I_PRODUCTIONSUPERVISOR",
"I_PRODUCTIONVERSION",
"I_STATUSCODETEXT",
"I_WBSELEMENT"
],
"BASE":
[
"I_MANUFACTURINGORDERITEM",
"I_MFGORDER",
"I_SALESDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/