@AbapCatalog.sqlViewName: 'IORDERCONFBSC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AccessControl.privilegedAssociations: ['_User', '_LongText']
@ClientHandling.algorithm: #SESSION_VARIABLE
@ClientHandling.type: #CLIENT_DEPENDENT
@ObjectModel.modelingPattern: #NONE
@ObjectModel.supportedCapabilities: [#CDS_MODELING_DATA_SOURCE, #SQL_DATA_SOURCE]
@ObjectModel.usageType: {serviceQuality: #A, sizeCategory: #XL, dataClass: #TRANSACTIONAL}
@VDM.lifecycle.contract.type: #PUBLIC_LOCAL_API
@VDM.viewType: #BASIC
@EndUserText.label: 'Order Confirmation Basic'
// Basic confirmation view with select from AFRU only
/*+[hideWarning] { "IDS" : [ "CALCULATED_FIELD_CHECK", "CARDINALITY_CHECK" ] } */
define view I_OrderConfirmationBasic
as select from afru as afru
association [1..1] to I_ConfirmationGroup as _ConfirmationGroup on $projection.ConfirmationGroup = _ConfirmationGroup.ConfirmationGroup
association [1..1] to I_LogisticsOrder as _Order on $projection.OrderID = _Order.OrderID
association [0..1] to I_OrderSequenceBySemKey as _OrderSequence on $projection.OrderID = _OrderSequence.OrderID
and $projection.Sequence = _OrderSequence.Sequence
association [0..1] to I_OrderOperationBasic as _OrderOperation on $projection.OrderInternalID = _OrderOperation.OrderInternalID
and $projection.OrderOperationInternalID = _OrderOperation.OrderOperationInternalID
association [0..1] to I_OrderOperationBySemKey as _OrderOperationBySemKey on $projection.OrderID = _OrderOperationBySemKey.OrderID
and $projection.Sequence = _OrderOperationBySemKey.Sequence
and $projection.OrderOperation_2 = _OrderOperationBySemKey.OrderOperation
association [1..1] to I_OrderInternalID as _OrderInternalID on $projection.OrderInternalID = _OrderInternalID.OrderInternalID
association [1..1] to I_User as _User on $projection.EnteredByUser = _User.UserID
association [0..1] to I_FinalConfirmationType as _FinalConfirmationType on $projection.FinalConfirmationType = _FinalConfirmationType.FinalConfirmationType
association [0..1] to I_OrderConfirmationType as _ConfirmationType on $projection.OrderConfirmationType = _ConfirmationType.OrderConfirmationType
association [0..1] to I_ConfirmationRecordType as _ConfirmationRecordType on $projection.OrderConfirmationRecordType = _ConfirmationRecordType.OrderConfirmationRecordType
association [1..1] to I_ConfirmationApplOrigin as _ConfirmationApplOrigin on $projection.ConfirmationApplicationOrigin = _ConfirmationApplOrigin.ConfirmationApplicationOrigin
association [0..1] to I_ConfirmationGroup as _MilestoneConfirmationGroup on $projection.MilestoneConfirmationGroup = _MilestoneConfirmationGroup.ConfirmationGroup
association [0..1] to I_OrderConfirmation as _MilestoneConfirmation on $projection.MilestoneConfirmationGroup = _MilestoneConfirmation.ConfirmationGroup
and $projection.MilestoneConfirmation = _MilestoneConfirmation.OrderConfirmation
association [1..1] to I_Plant as _Plant on $projection.Plant = _Plant.Plant
association [0..1] to I_WorkCenterType as _WorkCenterType on $projection.WorkCenterTypeCode = _WorkCenterType.WorkCenterTypeCode
association [0..1] to I_WorkCenter as _WorkCenter on $projection.WorkCenterTypeCode = _WorkCenter.WorkCenterTypeCode
and $projection.WorkCenterInternalID = _WorkCenter.WorkCenterInternalID
association [0..1] to I_Capacity as _Capacity on $projection.CapacityInternalID = _Capacity.CapacityInternalID
association [0..1] to I_ShiftGrouping as _ShiftGrouping on $projection.ShiftGrouping = _ShiftGrouping.ShiftGrouping
association [0..*] to I_ShiftDefinition as _ShiftDefinition on $projection.ShiftGrouping = _ShiftDefinition.ShiftGrouping
and $projection.ShiftDefinition = _ShiftDefinition.ShiftDefinition
association [0..1] to I_Language as _Language on $projection.Language = _Language.Language
association [0..1] to I_UnitOfMeasure as _BusinessProcessUnit on $projection.BusinessProcessEntryUnit = _BusinessProcessUnit.UnitOfMeasure
association [1..1] to I_UnitOfMeasure as _ConfirmationUnit on $projection.ConfirmationUnit = _ConfirmationUnit.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _OrderUnit on $projection.OrderQuantityUnit = _OrderUnit.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _WorkQuantityUnit1 on $projection.OpWorkQuantityUnit1 = _WorkQuantityUnit1.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _WorkQuantityUnit2 on $projection.OpWorkQuantityUnit2 = _WorkQuantityUnit2.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _WorkQuantityUnit3 on $projection.OpWorkQuantityUnit3 = _WorkQuantityUnit3.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _WorkQuantityUnit4 on $projection.OpWorkQuantityUnit4 = _WorkQuantityUnit4.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _WorkQuantityUnit5 on $projection.OpWorkQuantityUnit5 = _WorkQuantityUnit5.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _WorkQuantityUnit6 on $projection.OpWorkQuantityUnit6 = _WorkQuantityUnit6.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _ActualWorkQuantityUnit on $projection.ActualWorkQuantityUnit = _ActualWorkQuantityUnit.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _RemainingWorkQuantityUnit on $projection.RemainingWorkQuantityUnit = _RemainingWorkQuantityUnit.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _ActualDurationUnit on $projection.ActualDurationUnit = _ActualDurationUnit.UnitOfMeasure
association [0..1] to I_UnitOfMeasure as _BreakDurationUnit on $projection.BreakDurationUnit = _BreakDurationUnit.UnitOfMeasure
association [0..1] to I_VarianceReason as _VarianceReason on $projection.Plant = _VarianceReason.Plant
and $projection.VarianceReasonCode = _VarianceReason.VarianceReasonCode
association [0..1] to I_EmployeeWageGroup as _EmployeeWageGroup on $projection.Plant = _EmployeeWageGroup.Plant
and $projection.EmployeeWageGroup = _EmployeeWageGroup.EmployeeWageGroup
association [0..1] to I_EmployeeSuitability as _EmployeeSuitability on $projection.Plant = _EmployeeSuitability.Plant
and $projection.EmployeeSuitability = _EmployeeSuitability.EmployeeSuitability
association [0..1] to I_PersonWorkAgreement_1 as _PersonWorkAgreement on $projection.Personnel = _PersonWorkAgreement.PersonWorkAgreement
association [0..1] to I_WorkforcePerson as _Employee on $projection.Personnel = _Employee.PersonExternalID
association [1..1] to I_CalendarDate as _PostingDate on $projection.PostingDate = _PostingDate.CalendarDate
association [1..1] to I_CalendarYear as _PostingDateYear on $projection.PostingDateYear = _PostingDateYear.CalendarYear
association [0..1] to I_Indicator as _FinalConfIndicator on $projection.IsFinalConfirmation = _FinalConfIndicator.IndicatorValue
association [0..1] to I_Indicator as _ReversedIndicator on $projection.IsReversed = _ReversedIndicator.IndicatorValue
association [0..1] to I_Indicator as _ReversalIndicator on $projection.IsReversal = _ReversalIndicator.IndicatorValue
association [0..1] to I_Indicator as _LongTextIndicator on $projection.LongTextExists = _LongTextIndicator.IndicatorValue
association [0..1] to I_OrderConfLongText as _LongText on $projection.ConfirmationGroup = _LongText.ConfirmationGroup
and $projection.OrderConfirmation = _LongText.OrderConfirmation
{
// Key
key cast(afru.rueck as pph_rueck preserving type) as ConfirmationGroup,
@ObjectModel.text.element: ['ConfirmationText']
key cast(afru.rmzhl as pph_rmzhl preserving type) as OrderConfirmation,
// Order and Operation Data
afru.aufnr as OrderID,
cast(afru.aplfl as plnfolge preserving type) as Sequence,
@VDM.lifecycle.status: #DEPRECATED
@VDM.lifecycle.successor: 'OrderOperation_2'
afru.vornr as OrderOperation, // with conv. exit NUMCV
cast(afru.vornr as vdm_vornr preserving type) as OrderOperation_2, // w/o conversion exit
// Internal Keys
cast(afru.aufpl as pph_aufpl preserving type) as OrderInternalID,
cast(afru.aplzl as operationinternalid preserving type) as OrderOperationInternalID,
cast(afru.sumnr as pph_sumnr preserving type) as SuperiorOperationInternalID,
// Short Text
@Semantics.text: true
cast(afru.ltxa1 as pph_rtext preserving type) as ConfirmationText,
cast(afru.txtsp as spras preserving type) as Language,
cast(case
when afru.txtsp is not initial then 'X'
else ''
end as aufltext preserving type) as LongTextExists,
// Admin
@Semantics.systemDate.createdAt: true
cast(afru.ersda as ru_ersda preserving type) as ConfirmationEntryDate,
@Semantics.systemTime.createdAt: true
cast(afru.erzet as ru_erzet preserving type) as ConfirmationEntryTime,
@Semantics.user.createdBy: true
cast(afru.ernam as ru_ernam preserving type) as EnteredByUser,
@Semantics.systemDate.lastChangedAt: true
afru.laeda as LastChangeDate,
@Semantics.user.lastChangedBy: true
afru.aenam as LastChangedByUser,
@Semantics.systemDate.createdAt: true
cast(afru.exerd as ru_exerd preserving type) as ConfirmationExternalEntryDate,
@Semantics.systemTime.createdAt: true
cast(afru.exerz as ru_exerz preserving type) as ConfirmationExternalEntryTime,
afru.exnam as EnteredByExternalUser,
afru.extid as ExternalSystemConfirmation,
// Attributes
cast(afru.aueru as pph_aueru preserving type) as FinalConfirmationType,
cast(case
when afru.aueru = 'X' then 'X'
when afru.aueru <> 'X' then ''
end as endru preserving type) as IsFinalConfirmation,
afru.ausor as OpenReservationsIsCleared,
afru.stokz as IsReversed,
cast(case
when afru.stzhl = '00000000' then ''
when afru.stzhl > '00000000' then 'X'
end as pph_stzhl preserving type) as IsReversal,
afru.stzhl as CancldMfgOrderConfCount,
afru.no_goodsmovement_via_api as APIConfHasNoGoodsMovements,
cast(afru.orind as ru_orina preserving type) as ConfirmationApplicationOrigin,
cast(afru.origf as vdm_origf preserving type) as ConfirmationTimeEventOrigin,
afru.manur as OrderConfirmationType,
afru.satza as OrderConfirmationRecordType,
// Milestone
@VDM.lifecycle.status: #DEPRECATED
@VDM.lifecycle.successor: 'MilestoneConfirmationType'
afru.meilr as MilestoneIsConfirmed, // wrong data type for indicators
cast(afru.meilr as vdm_meilr preserving type) as MilestoneConfirmationType,
cast(case
when afru.manur = '2' then 'X'
when afru.manur <> '2' then ''
end as pph_meilr preserving type) as IsConfirmedByMilestoneConf,
cast(afru.rueck_mst as vdm_rueck_mst preserving type) as MilestoneConfirmationGroup,
cast(afru.rmzhl_mst as vdm_rmzhl_mst preserving type) as MilestoneConfirmation,
// Assignments
afru.werks as Plant,
cast('A ' as pph_objty preserving type) as WorkCenterTypeCode,
cast(afru.arbid as pph_arbid preserving type) as WorkCenterInternalID,
afru.kapid as CapacityInternalID,
cast(afru.split as pph_split preserving type) as CapacityRequirementSplit,
afru.schgrup as ShiftGrouping,
afru.kaptprog as ShiftDefinition,
afru.wablnr as MaterialDocument,
cast(substring(afru.budat, 1, 4) as vdm_mjahr) as MaterialDocumentYear,
cast(afru.weblnr as pph_weblnr preserving type) as FailedGoodsMovement,
cast(afru.pdsnr as sa_bdenr) as PlantDataCollectionID,
afru.obcha as OriginalBatch,
afru.licha as BatchBySupplier,
afru.skostl as SenderCostCenter,
// Assignments HR
cast(afru.pernr as pph_pernr preserving type) as Personnel,
cast(afru.zausw as pph_zausw preserving type) as TimeRecording,
cast(afru.loart as pph_loart preserving type) as EmployeeWageType,
cast(afru.logrp as pph_logrp preserving type) as EmployeeWageGroup,
cast(afru.qualf as pph_qualf preserving type) as EmployeeSuitability,
cast(afru.anzma as pph_anzms preserving type) as NumberOfEmployees,
// Dates
@Semantics.businessDate.at: true
cast(afru.budat as pph_budat preserving type) as PostingDate,
@Semantics.calendar.year: true
cast(substring(afru.budat, 1, 4) as calendaryear) as PostingDateYear,
// Time Events
cast(afru.isdd as vdm_isdd preserving type) as ConfirmedExecutionStartDate,
cast(afru.isdz as vdm_isdz preserving type) as ConfirmedExecutionStartTime,
cast(afru.ierd as vdm_ierd preserving type) as ConfirmedSetupEndDate,
cast(afru.ierz as vdm_ierz preserving type) as ConfirmedSetupEndTime,
cast(afru.isbd as vdm_isbd preserving type) as ConfirmedProcessingStartDate,
cast(afru.isbz as vdm_isbz preserving type) as ConfirmedProcessingStartTime,
cast(afru.iebd as vdm_iebd preserving type) as ConfirmedProcessingEndDate,
cast(afru.iebz as vdm_iebz preserving type) as ConfirmedProcessingEndTime,
cast(afru.isad as vdm_isad preserving type) as ConfirmedTeardownStartDate,
cast(afru.isaz as vdm_isaz preserving type) as ConfirmedTeardownStartTime,
cast(afru.iedd as vdm_iedd preserving type) as ConfirmedExecutionEndDate,
cast(afru.iedz as vdm_iedz preserving type) as ConfirmedExecutionEndTime,
cast(afru.pedd as pph_pedd preserving type) as ActualForecastEndDate,
cast(afru.pedz as pph_pedz preserving type) as ActualForecastEndTime,
// Quantities and UoM
@Semantics.unitOfMeasure: true
afru.meinh as ConfirmationUnit,
@Semantics.quantity.unitOfMeasure: 'ConfirmationUnit'
@Aggregation.default: #SUM
afru.lmnga as ConfirmationYieldQuantity,
@Semantics.quantity.unitOfMeasure: 'ConfirmationUnit'
@Aggregation.default: #SUM
afru.xmnga as ConfirmationScrapQuantity,
@Semantics.quantity.unitOfMeasure: 'ConfirmationUnit'
@Aggregation.default: #SUM
afru.rmnga as ConfirmationReworkQuantity,
@Semantics.quantity.unitOfMeasure: 'ConfirmationUnit'
@Aggregation.default: #SUM
cast((afru.lmnga + afru.xmnga + afru.rmnga) as pph_tmnga) as ConfirmationTotalQuantity,
@ObjectModel.foreignKey.association: '_VarianceReason'
cast(afru.grund as pph_agrnd preserving type) as VarianceReasonCode,
@Semantics.unitOfMeasure: true
cast(afru.gmein as pph_gmein preserving type) as OrderQuantityUnit,
@Semantics.quantity.unitOfMeasure: 'OrderQuantityUnit'
@Aggregation.default: #SUM
cast(afru.gmnga as pph_gmnga preserving type) as ConfirmedYieldQtyInOrderUnit,
@Semantics.unitOfMeasure: true
cast(' ' as operationunit) as OperationUnit, //initial, but kept for qty<->unit relation
@Semantics.quantity.unitOfMeasure: 'OperationUnit'
@Aggregation.default: #SUM
afru.smeng as OpPlannedTotalQuantity,
// Work Quantities and UoM
@Semantics.unitOfMeasure: true
cast(afru.ile01 as vdm_ile01 preserving type) as OpWorkQuantityUnit1,
@Semantics.quantity.unitOfMeasure: 'OpWorkQuantityUnit1'
@Aggregation.default: #SUM
cast(afru.ism01 as vdm_ism01 preserving type) as OpConfirmedWorkQuantity1,
cast(afru.lek01 as vdm_lek01 preserving type) as NoFurtherOpWorkQuantity1IsExpd,
@Semantics.unitOfMeasure: true
cast(afru.ile02 as vdm_ile02 preserving type) as OpWorkQuantityUnit2,
@Semantics.quantity.unitOfMeasure: 'OpWorkQuantityUnit2'
@Aggregation.default: #SUM
cast(afru.ism02 as vdm_ism02 preserving type) as OpConfirmedWorkQuantity2,
cast(afru.lek02 as vdm_lek02 preserving type) as NoFurtherOpWorkQuantity2IsExpd,
@Semantics.unitOfMeasure: true
cast(afru.ile03 as vdm_ile03 preserving type) as OpWorkQuantityUnit3,
@Semantics.quantity.unitOfMeasure: 'OpWorkQuantityUnit3'
@Aggregation.default: #SUM
cast(afru.ism03 as vdm_ism03 preserving type) as OpConfirmedWorkQuantity3,
cast(afru.lek03 as vdm_lek03 preserving type) as NoFurtherOpWorkQuantity3IsExpd,
@Semantics.unitOfMeasure: true
cast(afru.ile04 as vdm_ile04 preserving type) as OpWorkQuantityUnit4,
@Semantics.quantity.unitOfMeasure: 'OpWorkQuantityUnit4'
@Aggregation.default: #SUM
cast(afru.ism04 as vdm_ism04 preserving type) as OpConfirmedWorkQuantity4,
cast(afru.lek04 as vdm_lek04 preserving type) as NoFurtherOpWorkQuantity4IsExpd,
@Semantics.unitOfMeasure: true
cast(afru.ile05 as vdm_ile05 preserving type) as OpWorkQuantityUnit5,
@Semantics.quantity.unitOfMeasure: 'OpWorkQuantityUnit5'
@Aggregation.default: #SUM
cast(afru.ism05 as vdm_ism05 preserving type) as OpConfirmedWorkQuantity5,
cast(afru.lek05 as vdm_lek05 preserving type) as NoFurtherOpWorkQuantity5IsExpd,
@Semantics.unitOfMeasure: true
cast(afru.ile06 as vdm_ile06 preserving type) as OpWorkQuantityUnit6,
@Semantics.quantity.unitOfMeasure: 'OpWorkQuantityUnit6'
@Aggregation.default: #SUM
cast(afru.ism06 as vdm_ism06 preserving type) as OpConfirmedWorkQuantity6,
cast(afru.lek06 as vdm_lek06 preserving type) as NoFurtherOpWorkQuantity6IsExpd,
// Work Quantities PM/PS
@Semantics.unitOfMeasure: true
afru.ismne as ActualWorkQuantityUnit,
@Semantics.quantity.unitOfMeasure: 'ActualWorkQuantityUnit'
@Aggregation.default: #SUM
afru.ismnw as ActualWorkQuantity,
@Semantics.unitOfMeasure: true
afru.ofmne as RemainingWorkQuantityUnit,
@Semantics.quantity.unitOfMeasure: 'RemainingWorkQuantityUnit'
@Aggregation.default: #SUM
afru.ofmnw as RemainingWorkQuantity,
afru.leknw as NoFurtherWorkQuantityIsExpd,
afru.learr as ActivityType,
// Business Process
afru.prz01 as BusinessProcess,
@Semantics.unitOfMeasure: true
afru.ipre1 as BusinessProcessEntryUnit,
@Semantics.quantity.unitOfMeasure: 'BusinessProcessEntryUnit'
@Aggregation.default: #SUM
afru.iprz1 as BusinessProcessConfirmedQty,
afru.iprk1 as NoFurtherBusinessProcQtyIsExpd,
@Semantics.unitOfMeasure: true
afru.opre1 as BusinessProcRemainingQtyUnit,
@Semantics.quantity.unitOfMeasure: 'BusinessProcRemainingQtyUnit'
@Aggregation.default: #SUM
cast(afru.oprz1 as pph_oprz1 preserving type) as BusinessProcessRemainingQty,
// Durations
@Semantics.unitOfMeasure: true
cast(afru.idaue as vdm_idaure preserving type) as ActualDurationUnit,
@Semantics.calendarItem.duration: true
afru.idaur as ActualDuration,
@Semantics.unitOfMeasure: true
afru.zeier as BreakDurationUnit,
@Semantics.calendarItem.duration: true
afru.iserh as ConfirmedBreakDuration,
// Associations
_ConfirmationGroup,
_Order,
_OrderSequence,
_OrderOperation,
_OrderOperationBySemKey,
_OrderInternalID,
_FinalConfirmationType,
_ConfirmationType,
_ConfirmationRecordType,
_ConfirmationApplOrigin,
_MilestoneConfirmationGroup,
_MilestoneConfirmation,
_User,
_Language,
_WorkCenterType,
_WorkCenter,
_Plant,
_Capacity,
_ShiftGrouping,
_ShiftDefinition,
_BusinessProcessUnit,
_ConfirmationUnit,
_OrderUnit,
_WorkQuantityUnit1,
_WorkQuantityUnit2,
_WorkQuantityUnit3,
_WorkQuantityUnit4,
_WorkQuantityUnit5,
_WorkQuantityUnit6,
_ActualWorkQuantityUnit,
_RemainingWorkQuantityUnit,
_ActualDurationUnit,
_BreakDurationUnit,
_VarianceReason,
_EmployeeWageGroup,
_EmployeeSuitability,
_Employee,
_PersonWorkAgreement,
_PostingDate,
_PostingDateYear,
_FinalConfIndicator,
_ReversedIndicator,
_ReversalIndicator,
_LongTextIndicator,
_LongText
};