@AccessControl.authorizationCheck: #MANDATORY
@VDM: { viewType: #TRANSACTIONAL, lifecycle.contract.type: #SAP_INTERNAL_API }
@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #L, dataClass: #TRANSACTIONAL}
@VDM.usage.type: [#TRANSACTIONAL_PROCESSING_SERVICE]
@EndUserText.label: 'Maintenance Order Operation Component TP'
define view entity R_MaintOrderOpComponentTP_2
as select from I_MaintenanceOrderComponent_2
association to parent R_MaintenanceOrderOperationTP as _MaintenanceOrderOperation on (
$projection.MaintenanceOrderOperation = _MaintenanceOrderOperation.MaintenanceOrderOperation
and $projection.MaintenanceOrderSubOperation = _MaintenanceOrderOperation.MaintenanceOrderSubOperation
and $projection.MaintenanceOrder = _MaintenanceOrderOperation.MaintenanceOrder
)
composition [0..*] of R_MaintOrderOpCompLongTextTP_2 as _MaintOrderOpCompLongText
association [1..1] to R_MaintenanceOrderTP as _MaintenanceOrder on $projection.MaintenanceOrder = _MaintenanceOrder.MaintenanceOrder
association [0..1] to I_WBSElementBasicData as _WBSElement on _WBSElement.WBSElementInternalID = $projection.MaintOrdOpCompAssgdWBSElmntInt
association of one to one I_MaintOrdOpCompProcmtQuantity as _CompRcvdQuantity on $projection.MaintenanceOrder = _CompRcvdQuantity.MaintenanceOrder
and $projection.MaintenanceOrderOperation = _CompRcvdQuantity.MaintenanceOrderOperation
and $projection.MaintenanceOrderSubOperation = _CompRcvdQuantity.MaintenanceOrderSubOperation
and $projection.MaintOrderComponentInternalID = _CompRcvdQuantity.MaintOrderComponentInternalID
association [0..1] to I_CostElement as _CostElement on $projection.ControllingArea = _CostElement.ControllingArea
and $projection.MaintOrdOpComponentGLAccount = _CostElement.CostElement
association of one to many I_PurReqnOrResvnGenerationText as _PurReqnOrResvnGenerationText on $projection.PurReqnOrResvnGeneration = _PurReqnOrResvnGenerationText.PurReqnOrResvnGeneration
association of one to many I_MaterialGroupText as _MaterialGroupText on $projection.MaterialGroup = _MaterialGroupText.MaterialGroup
association of one to many I_UnitOfMeasureText as _UnitOfMeasureText on $projection.BaseUnit = _UnitOfMeasureText.UnitOfMeasure
{
key MaintenanceOrder,
key MaintenanceOrderOperation,
key MaintenanceOrderSubOperation,
key MaintOrderComponentInternalID,
MaintenanceOrderComponent,
@ObjectModel.editableFieldFor: 'MaintenanceOrderOperation'
cast( MaintenanceOrderOperation as maintenanceorderoperation preserving type ) as MaintOrderOperationForEdit,
@ObjectModel.editableFieldFor: 'MaintenanceOrderSubOperation'
cast( MaintenanceOrderSubOperation as maintenanceordersuboperation preserving type ) as MaintOrderSubOperationForEdit,
Reservation,
ReservationItem,
ReservationType,
MaintOrderRoutingNumber,
MaintOrderOperationCounter,
Material as Product,
case when Material = ''
then ComponentDescription
else cast ( _MaterialText[1:Language = $session.system_language ].MaterialName as potx1 preserving type ) end as MaintOrdOperationComponentText,
@Semantics.quantity.unitOfMeasure: 'BaseUnit'
cast(case MaintOrderCompDebitCreditCode
when 'S' then -RequirementQuantityInBaseUnit
else RequirementQuantityInBaseUnit
end as bdmng ) as MaintOrdOpCompRequiredQuantity,
BaseUnit,
@Semantics.quantity.unitOfMeasure: 'UnitOfEntry'
cast(case MaintOrderCompDebitCreditCode
when 'S' then -QuantityInUnitOfEntry
else QuantityInUnitOfEntry
end as erfmg ) as QuantityInUnitOfEntry,
UnitOfEntry,
case when RequirementTime = '240000' and RequirementDate is not initial
then cast( tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( RequirementDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as bdter preserving type )
else cast( tstmp_to_dats( dats_tims_to_tstmp(RequirementDate, RequirementTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as bdter preserving type )
end as RequirementDate,
case when RequirementTime = '240000' and RequirementDate is not initial
then cast( tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( RequirementDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as bdztp preserving type )
else cast( tstmp_to_tims( dats_tims_to_tstmp(RequirementDate, RequirementTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as bdztp preserving type )
end as RequirementTime,
case when RequirementTime = '240000' and RequirementDate is not initial
then cast(dats_tims_to_tstmp( dats_add_days( RequirementDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
else cast(dats_tims_to_tstmp( RequirementDate, RequirementTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
end as RequirementDateTime,
Supplier,
Plant,
StorageLocation,
MaintComponentItemCategory as MaintOrdOpCompItemCategory,
//_ItemCategoryText[1:Language = $session.system_language ].BillOfMaterialItemCategoryDesc as BillOfMaterialItemCategoryDesc,
GoodsMovementType,
ReservationIsFinallyIssued,
MaterialGroup,
PurReqnOrResvnGeneration,
MaterialCompIsProcuredDirectly,
ProductTypeCode,
ServicePerformer,
case when PerformancePeriodStartTime = '240000' and PerformancePeriodStartDate is not initial
then cast(dats_tims_to_tstmp( dats_add_days( PerformancePeriodStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
else cast(dats_tims_to_tstmp( PerformancePeriodStartDate, PerformancePeriodStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
end as PerformancePeriodStartDateTime,
case when PerformancePeriodStartTime = '240000' and PerformancePeriodStartDate is not initial
then cast( tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( PerformancePeriodStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as mmpur_servproc_period_start preserving type )
else cast( tstmp_to_dats( dats_tims_to_tstmp(PerformancePeriodStartDate, PerformancePeriodStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as mmpur_servproc_period_start preserving type )
end as PerformancePeriodStartDate,
case when PerformancePeriodStartTime = '240000' and PerformancePeriodStartDate is not initial
then cast( tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( PerformancePeriodStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as performanceperiodstarttime preserving type )
else cast( tstmp_to_tims( dats_tims_to_tstmp(PerformancePeriodStartDate, PerformancePeriodStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as performanceperiodstarttime preserving type )
end as PerformancePeriodStartTime,
case when PerformancePeriodEndTime = '240000' and PerformancePeriodEndDate is not initial
then cast(dats_tims_to_tstmp( dats_add_days( PerformancePeriodEndDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
else cast(dats_tims_to_tstmp( PerformancePeriodEndDate, PerformancePeriodEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
end as PerformancePeriodEndDateTime,
case when PerformancePeriodEndTime = '240000' and PerformancePeriodEndDate is not initial
then cast( tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( PerformancePeriodEndDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as mmpur_servproc_period_end preserving type )
else cast( tstmp_to_dats( dats_tims_to_tstmp(PerformancePeriodEndDate, PerformancePeriodEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as mmpur_servproc_period_end preserving type )
end as PerformancePeriodEndDate,
case when PerformancePeriodEndTime = '240000' and PerformancePeriodEndDate is not initial
then cast( tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( PerformancePeriodEndDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as performanceperiodendtime preserving type )
else cast( tstmp_to_tims( dats_tims_to_tstmp(PerformancePeriodEndDate, PerformancePeriodEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' ) as performanceperiodendtime preserving type )
end as PerformancePeriodEndTime,
LeanServiceDuration,
LeanServiceDurationUnit,
DistributionFunction,
MaintOrdCompDeliveryDateAdjmt,
SrvcSchedgIsAlignedWthOpWrkCtr,
MaintOrderCompDebitCreditCode,
GoodsMovementIsAllowed,
MaintenanceOrderComponentBatch,
QuantityIsFixed,
MaintOrdOpComponentCurrency,
MaintOrdOpComponentGLAccount,
MaintOrdOpCompCostingRelevancy,
MaintCompAltvProdUsgeRateInPct,
MaintOrderOpComponentSortText,
MaintOrdOpCompIsBulkProduct,
MaterialProvisionType,
MaintOrdOpCompAssgdWBSElmntInt,
cast ( _WBSElement.WBSElement as vdm_ps_posid preserving type ) as WBSElement,
MaintOrderOpComponentPrice,
MaintOrdOpCompPriceUnitQty,
MatlCompIsMarkedForBackflush,
PurchasingGroup,
DeliveryTimeInDays,
MaintOrdOpCompGdsRecipientName,
MaintOrdOpCompUnloadingPtTxt,
GoodsReceiptDurationInWorkDays,
PurchasingInfoRecord,
OperationLeadTimeOffset,
OpsLeadTimeOffsetUnit,
MaintOrdOpCompRequisitioner,
cast ( coalesce( _PurchaseRequisitionItem.RequirementTracking , MaintOrdOpCompProcmtTrckgNmbr ) as bednr preserving type ) as MaintOrdOpCompProcmtTrckgNmbr,
ResponsiblePurchaseOrg,
PurchaseRequisition,
PurchaseRequisitionItem,
OverallLimitAmount,
ExpectedOverallLimitAmount,
// MaintOrdCompIsDirectlyProcured,
MaintOrdOpCompSpecialStockType,
VariableSizeDimension1,
VariableSizeDimensionUnit,
VariableSizeCompFormulaKey,
VariableSizeDimension2,
NumberOfVariableSizeItem,
VariableSizeDimension3,
VariableSizeItemQuantity,
VariableSizeComponentUnit,
RqmtDateIsEnteredManually,
SupplierProduct,
MaintOrdCompCmtdQtyIsKept,
MaintOrdOpCompPurOutlineAgrmt,
MaintOrdCompPurOutlineAgrmtItm,
IsDeleted,
MaintOrdOpCompProcmtCatalog,
MaintOrdOpCompProcmtCatalogItm,
QuantityWithdrawnInBaseUnit,
ConfirmedAvailableQuantity,
_CompRcvdQuantity,
_MaintenanceOrderOperation.OperationDescription,
_ReservationItem.RecipientLocationCode,
_MaintenanceOrder.ControllingArea as ControllingArea,
_MaintenanceOrder,
_MaintenanceOrderOperation,
_ReservationItem,
_UnitOfMeasure,
_UnitOfMeasureEntry,
_Plant,
_StorageLocation,
_ItemCategoryText,
_ProductTypeCode,
_ReservationIsFinallyIssued,
_MaterialGroup,
_PurReqnOrResvnGeneration,
_Supplier,
_MaintOrderOpCompLongText,
_MaintOrdCompDelivDateAdjmtT,
_PurReqnOrResvnGenerationText,
_MaterialGroupText,
_UnitOfMeasureText,
_PurchasingGroup,
_PurchasingOrganization,
_CostElement
}
where
_StatusObjectActiveStatus [1: StatusCode = 'I0013'].StatusCode is null // mark for deletion based on system status
//and IsDeleted