P_MPEProcOrderItemPover

DDL: P_MPEPROCORDERITEMPOVER Type: view_entity CONSUMPTION Package: ODATA_MPE_MFGORDER

Process Order Item

P_MPEProcOrderItemPover is a Consumption CDS View that provides data about "Process Order Item" in SAP S/4HANA. It reads from 2 data sources (I_ManufacturingOrderItem, I_MfgOrder) and exposes 80 fields with key fields ManufacturingOrder, ManufacturingOrderItem. It has 5 associations to related views. Part of development package ODATA_MPE_MFGORDER.

Data Sources (2)

SourceAliasJoin Type
I_ManufacturingOrderItem Item inner
I_MfgOrder mfgorder from

Associations (5)

CardinalityTargetAliasCondition
[0..1] P_MPEProdnOrdItmDvtnDurn _OrdData $projection.ManufacturingOrder = _OrdData.ManufacturingOrder
[0..1] I_StatusCodeText _StatusText $projection.orderstatus = _StatusText.StatusCode and _StatusText.StatusProfile = '' and _StatusText.Language = $session.system_language
[0..1] I_MfgOrder _LeadingMfgOrder $projection.LeadingOrder = _LeadingMfgOrder.ManufacturingOrder
[0..1] I_WBSElementBasicData _WBSElement $projection.WBSElementInternalID = _WBSElement.WBSElementInternalID
[0..1] I_EntProjectResponsiblePerson _ProjectRespPersn $projection.WBSElementInternalID = _ProjectRespPersn.WBSElementInternalID and _ProjectRespPersn.WBSElementInternalID is not initial

Annotations (11)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
AccessControl.personalData.blocking #REQUIRED view
EndUserText.label Process Order Item view
VDM.private true view
Search.searchable false view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #CONSUMPTION view
Metadata.allowExtensions false view
Metadata.ignorePropagatedAnnotations true view

Fields (80)

KeyFieldSource TableSource FieldDescription
KEY ManufacturingOrder I_MfgOrder ManufacturingOrder
KEY ManufacturingOrderItem I_ManufacturingOrderItem ManufacturingOrderItem
OrderInternalBillOfOperations I_MfgOrder OrderInternalBillOfOperations
ManufacturingOrderCategory I_MfgOrder ManufacturingOrderCategory
ProductionPlant I_ManufacturingOrderItem ProductionPlant
Material I_ManufacturingOrderItem Material
MaterialName
OrderStatus _OrdData OrderStatus
ManufacturingOrderImportance I_MfgOrder ManufacturingOrderImportance
ManufacturingOrderType I_MfgOrder ManufacturingOrderType
ManufacturingOrderTypeName
MfgOrderScheduledReleaseDate I_MfgOrder MfgOrderScheduledReleaseDate
MfgOrderScheduledStartDate I_MfgOrder MfgOrderScheduledStartDate
MfgOrderScheduledEndDate I_MfgOrder MfgOrderScheduledEndDate
MfgOrderPlannedStartDate I_MfgOrder MfgOrderPlannedStartDate
MfgOrderPlannedStartTime I_MfgOrder MfgOrderPlannedStartTime
MfgOrderPlannedEndDate I_MfgOrder MfgOrderPlannedEndDate
MfgOrderPlannedEndTime I_MfgOrder MfgOrderPlannedEndTime
MfgOrderActualStartDate I_MfgOrder MfgOrderActualStartDate
MfgOrderActualStartTime I_MfgOrder MfgOrderActualStartTime
MfgOrderActualEndDate I_MfgOrder MfgOrderActualEndDate
MaterialGoodsReceiptDuration _OrdData MaterialGoodsReceiptDuration
ProductionUnit I_MfgOrder ProductionUnit
MfgOrderItemProductionUnit I_ManufacturingOrderItem ProductionUnit
MfgOrderPlannedTotalQty I_MfgOrder MfgOrderPlannedTotalQty
MfgOrderItemPlannedTotalQty I_ManufacturingOrderItem MfgOrderItemPlannedTotalQty
MfgOrderPlannedScrapQty I_MfgOrder MfgOrderPlannedScrapQty
MfgOrderItemPlannedScrapQty I_ManufacturingOrderItem MfgOrderItemPlannedScrapQty
ActualDeliveredQuantity I_MfgOrder ActualDeliveredQuantity
MfgOrderItemGoodsReceiptQty I_ManufacturingOrderItem MfgOrderItemGoodsReceiptQty
ExpectedDeviationQuantity
IsCompletelyDelivered I_ManufacturingOrderItem IsCompletelyDelivered
ProductionVersion I_ManufacturingOrderItem ProductionVersion
ProductionVersionText
Plant
ProductionLine
WorkCenterText
MRPPlant I_MfgOrder MRPPlant
MRPController I_MfgOrder MRPController
MRPControllerName
ProductionSupervisor I_ManufacturingOrderItem ProductionSupervisor
ProductionSupervisorName
LeadingMfgOrderMaterial _LeadingMfgOrder Material
LeadingMfgOrderMaterialName
LeadingOrder I_MfgOrder LeadingOrder
SlsDoc I_MfgOrder SalesDocument
SlsDocItm I_MfgOrder SalesDocumentItem
SlsDocCat
SlsDocCatName
SDDocument
SDDocumentItem
SDDocumentCategory
SDDocumentCategoryName
ReferenceSDDocument I_MfgOrder SalesOrder
ReferenceSDDocumentItem I_MfgOrder SalesOrderItem
SoldToParty
CustomerName
AuthorizationGroup
SalesOrderItemMaterial
SalesOrderItemMaterialName
WBSElement _WBSElement WBSElementExternalID
WBSDescription _WBSElement WBSDescription
ProjectResponsiblePerson
ProjectResponsiblePersonName
Project
ProjectDescription
InspectionLot I_MfgOrder InspectionLot
clientNULLendasLastChangeDateTime
_OrdInternalBillOfOperations I_MfgOrder _OrdInternalBillOfOperations
_MfgOrderCategory I_MfgOrder _MfgOrderCategory
_Material I_ManufacturingOrderItem _Material
_StatusText _StatusText
_MfgOrderType I_MfgOrder _MfgOrderType
_ProductionVersion I_ManufacturingOrderItem _ProductionVersion
_ProductionPlant I_ManufacturingOrderItem _ProductionPlant
_MRPPlant I_MfgOrder _MRPPlant
_MRPController I_MfgOrder _MRPController
_ProductionSupervisor I_ManufacturingOrderItem _ProductionSupervisor
WBSElementInternalID I_MfgOrder WBSElementInternalID
_SoldToParty
@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 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
  association [0..1] to I_WBSElementBasicData         as _WBSElement       on $projection.WBSElementInternalID       = _WBSElement.WBSElementInternalID // instead of I_WBSElement for cloud 

  association [0..1] to I_EntProjectResponsiblePerson as _ProjectRespPersn on $projection.WBSElementInternalID       = _ProjectRespPersn.WBSElementInternalID
                                                                          and _ProjectRespPersn.WBSElementInternalID is not initial 
{

      @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,

      //Sales Item Material  

      mfgorder._SalesDocumentItem.Material                                                                                                          as SalesOrderItemMaterial,

      //Sales Item Material  

      mfgorder._SalesOrderItem._Material._Text[1: Language = $session.system_language ].MaterialName                                                as SalesOrderItemMaterialName,

      //WBS Element

      _WBSElement.WBSElementExternalID                                                                                                              as WBSElement,

      //Element Description

      @Semantics.text
      _WBSElement.WBSDescription,                                                                         

      cast( _ProjectRespPersn.PersonWorkAgreement as ps_s4_vernr preserving type )                                                                  as ProjectResponsiblePerson,  
      _ProjectRespPersn._WorkforcePerson.PersonFullName                                                                                             as ProjectResponsiblePersonName,

      //Project

      _WBSElement._Project.ProjectExternalID                                                                                                        as Project,

      //Project Description

      @Semantics.text
      //To use the language key leads to errors in this case

      _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,
      Item._ProductionSupervisor,
      mfgorder.WBSElementInternalID,
      mfgorder._SalesDocument._SoldToParty
}
where
  mfgorder.ManufacturingOrderCategory = '40'; //Process Orders