@AccessControl.authorizationCheck: #NOT_REQUIRED
@AccessControl.personalData.blocking: #REQUIRED
@EndUserText.label: 'Process Orders'
@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_MPEProcOrderPover
as select from I_MfgOrder as mfgorder
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 _SuperiorMfgOrder on $projection.MfgOrderSuperiorMfgOrder = _SuperiorMfgOrder.ManufacturingOrder
{
@Search: {defaultSearchElement: true, ranking: #HIGH, fuzzinessThreshold: 0.8}
key mfgorder.ManufacturingOrder,
//Bill of Operations
@UI.hidden: true
mfgorder.OrderInternalBillOfOperations,
//Manufactoring Order Category
@UI.hidden: true
mfgorder.ManufacturingOrderCategory,
//Production Plant
@UI.hidden: true
mfgorder.ProductionPlant,
//Material
mfgorder.Material,
//Material Description
@Semantics.text
mfgorder._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 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,
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
//Order Quantity
mfgorder.MfgOrderPlannedTotalQty,
//Scrap Quantity
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
mfgorder.MfgOrderPlannedScrapQty,
//Goods Receipt Quantity
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
mfgorder.ActualDeliveredQuantity,
//Expected Deviation Quantity
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
mfgorder.ExpectedDeviationQuantity * (-1) as ExpectedDeviationQuantity,
@Semantics.quantity.unitOfMeasure: 'ProductionUnit'
case
when IsCompletelyDelivered = 'X'
then MfgOrderPlannedTotalQty * 0
else MfgOrderPlannedTotalQty - MfgOrderPlannedScrapQty - ActualDeliveredQuantity - ExpectedDeviationQuantity
end as OpenQuantity,
//Delivery Completed Indicator
mfgorder.IsCompletelyDelivered,
//Product Version
mfgorder.ProductionVersion,
//Product Version Description
@Semantics.text
mfgorder._ProductionVersion.ProductionVersionText,
//Production Version Plant
@UI.hidden: true
mfgorder._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
mfgorder.ProductionSupervisor,
//Production Supervisor Description
@Semantics.text
mfgorder._ProductionSupervisor.ProductionSupervisorName,
//Superior Order
mfgorder.MfgOrderSuperiorMfgOrder,
//Superior Order Material
_SuperiorMfgOrder.Material as SuperiorMfgOrderMaterial,
//Superior Order Material Name
_SuperiorMfgOrder._Material._Text[1: Language = $session.system_language].MaterialName as SuperiorMfgOrderMaterialName,
//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)
_SalesDocumentItem.SDDocumentCategory as SlsDocCat,
//Sales Document Category Description
@Semantics.text
_SalesDocumentItem._SDDocumentCategory._Text[1: Language = $session.system_language].SDDocumentCategoryName as SlsDocCatName,
//If follow-up document is not available take the actual document
coalesce( _SalesDocumentItem.SalesDocument, mfgorder.SalesOrder ) as SDDocument,
//If follow-up document is not available take the actual document
coalesce( _SalesDocumentItem.SalesDocumentItem, mfgorder.SalesOrderItem ) as SDDocumentItem,
//If follow-up document is not available take the actual document
coalesce( _SalesDocumentItem.SDDocumentCategory, mfgorder._SalesDocumentItem.SDDocumentCategory ) as SDDocumentCategory,
//If follow-up document is not available take the actual document
@Semantics.text
coalesce( _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
_WBSElement.WBSElement,
//Element Description
@Semantics.text
_WBSElement.WBSDescription,
cast( case
when _WBSElement.ResponsiblePerson = '00000000' or _WBSElement.ResponsiblePerson is null
then _WBSElement2._EntProjectResponsiblePerson.PersonWorkAgreement
else
_WBSElement.ResponsiblePerson
end as ps_s4_vernr preserving type ) as ProjectResponsiblePerson,
cast( case
when _WBSElement.ResponsiblePerson = '00000000' or _WBSElement.ResponsiblePerson is null
then _WBSElement2._EntProjectResponsiblePerson._WorkforcePerson.PersonFullName
else
_WBSElement.ResponsiblePersonName
end as ad_namtext preserving type ) as ProjectResponsiblePersonName,
//Project
_WBSElement._Project.Project,
//Project Description
@Semantics.text
//To use the language key leads to errors in this case
_WBSElement._Project.ProjectDescription,
//Inspection Lot
mfgorder.InspectionLot,
dats_tims_to_tstmp( mfgorder.LastChangeDate, mfgorder.LastChangeTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL' ) as LastChangeDateTime,
//Associations
_OrdInternalBillOfOperations,
_MfgOrderCategory,
_Material,
_StatusText,
_MfgOrderType,
_ProductionVersion,
_Plant,
_MRPPlant,
_MRPController,
_WBSElement2,
_ProductionSupervisor,
mfgorder.WBSElementInternalID,
mfgorder._SalesDocument._SoldToParty
}
where
mfgorder.ManufacturingOrderCategory = '40'; //Process Orders
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CUSTOMER",
"I_ENTPROJECTRESPONSIBLEPERSON",
"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_MFGORDER",
"I_SALESDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/