@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Maintenance Order TP'
@VDM.viewType: #COMPOSITE
@VDM.usage.type: [#TRANSACTIONAL_PROCESSING_SERVICE]
@VDM.lifecycle.contract.type: #SAP_INTERNAL_API
@ObjectModel.usageType: {serviceQuality: #C, sizeCategory: #L, dataClass: #TRANSACTIONAL}
@ObjectModel.sapObjectNodeType.name: 'MaintenanceOrder'
@AbapCatalog.extensibility: {
extensible: true,
dataSources: ['_MaintenanceOrderExtension'],
elementSuffix: 'ORI',
quota: {
maximumFields: 250,
maximumBytes: 5000
}
}
define root view entity R_MaintenanceOrderTP
as select from I_MaintenanceOrder
composition [0..*] of R_MaintenanceOrderOperationTP as _MaintenanceOrderOperation
composition [0..*] of R_MaintOrdObjectListItemTP as _MaintOrderObjectListItem
composition [0..*] of R_MaintOrderSettlmtDistrRuleTP as _MaintOrderSettlmtDistrRule
composition [0..*] of R_MaintOrderPhaseControlTP as _MaintenanceOrderPhaseControl
composition [0..*] of R_MaintenanceOrderPartnerTP as _MaintenanceOrderPartner
composition [0..*] of R_MaintenanceOrderLongTextTP as _MaintenanceOrderLongText
composition [0..*] of R_MaintOrdSettlmtDistrRuleTP_2 as _MaintOrderSettlmtDistrRule_2
association [0..1] to I_FunctionalLocationLabel as _FunctionalLocationLabel on _FunctionalLocationLabel.FunctionalLocation = $projection.FunctionalLocation
association [0..1] to E_MaintenanceOrder as _MaintenanceOrderExtension on _MaintenanceOrderExtension.MaintenanceOrder = $projection.MaintenanceOrder
association [0..1] to I_WBSElementBasicData as _WBSElement on $projection.WBSElementInternalID = _WBSElement.WBSElementInternalID
association [0..1] to I_WBSElementBasicData as _LocAcctAssgmtWBSElement on $projection.LocAcctAssgmtWBSElmntIntID = _LocAcctAssgmtWBSElement.WBSElementInternalID
association [0..1] to I_ProjectBasicData as _ProjectBasicData on $projection.ProjectInternalID = _ProjectBasicData.ProjectInternalID
association [0..1] to I_PersonWorkAgreement_1 as _PersonResponsible on $projection.MaintOrdPersonResponsible = _PersonResponsible.PersonWorkAgreement
//TEXTs
association [0..*] to I_EAMProcessPhaseText as _EAMProcessPhaseText on _EAMProcessPhaseText.EAMProcessPhaseCode = $projection.MaintOrdProcessPhaseCode
association [0..*] to I_EAMProcessSubPhaseText as _EAMProcessSubPhaseText on _EAMProcessSubPhaseText.EAMProcessSubPhaseCode = $projection.MaintOrdProcessSubPhaseCode
association [0..1] to I_MaintOrderTechObj as _MaintOrderTechObj on _MaintOrderTechObj.MaintenanceOrder = $projection.MaintenanceOrder //added
{
key MaintenanceOrder,
MaintOrderRoutingNumber,
MaintenanceOrderType,
MaintenanceOrderDesc,
case MaintOrdBasicStartTime when '240000'
then cast(dats_tims_to_tstmp( dats_add_days( MaintOrdBasicStartDate, 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( MaintOrdBasicStartDate, MaintOrdBasicStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL') as timestamp preserving type)
end as MaintOrdBasicStartDateTime,
case MaintOrdBasicEndTime when '240000'
then cast(dats_tims_to_tstmp( dats_add_days( MaintOrdBasicEndDate, 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( MaintOrdBasicEndDate, MaintOrdBasicEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL') as timestamp preserving type)
end as MaintOrdBasicEndDateTime,
case MaintOrdBasicStartTime when '240000'
then tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( MaintOrdBasicStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_dats( dats_tims_to_tstmp(MaintOrdBasicStartDate, MaintOrdBasicStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as MaintOrdBasicStartDate,
case MaintOrdBasicStartTime when '240000'
then tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( MaintOrdBasicStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_tims( dats_tims_to_tstmp(MaintOrdBasicStartDate, MaintOrdBasicStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as MaintOrdBasicStartTime,
case MaintOrdBasicEndTime when '240000'
then tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( MaintOrdBasicEndDate, 1, 'NULL'),
cast( '000000' as abap.tims ), abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_dats( dats_tims_to_tstmp(MaintOrdBasicEndDate, MaintOrdBasicEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as MaintOrdBasicEndDate,
case MaintOrdBasicEndTime when '240000'
then tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( MaintOrdBasicEndDate, 1, 'NULL'),
cast( '000000' as abap.tims ), abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_tims( dats_tims_to_tstmp(MaintOrdBasicEndDate, MaintOrdBasicEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as MaintOrdBasicEndTime,
case ScheduledBasicStartTime when '240000'
then cast(dats_tims_to_tstmp( dats_add_days( ScheduledBasicStartDate, 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( ScheduledBasicStartDate, ScheduledBasicStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL') as timestamp preserving type)
end as MaintOrdSchedldBscStrtDateTime,
case ScheduledBasicEndTime when '240000'
then cast(dats_tims_to_tstmp( dats_add_days( ScheduledBasicEndDate, 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( ScheduledBasicEndDate, ScheduledBasicEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL') as timestamp preserving type)
end as MaintOrdSchedldBscEndDateTime,
case ScheduledBasicStartTime when '240000'
then tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( ScheduledBasicStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_dats( dats_tims_to_tstmp(ScheduledBasicStartDate, ScheduledBasicStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as ScheduledBasicStartDate,
case ScheduledBasicStartTime when '240000'
then tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( ScheduledBasicStartDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_tims( dats_tims_to_tstmp(ScheduledBasicStartDate, ScheduledBasicStartTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as ScheduledBasicStartTime,
case ScheduledBasicEndTime when '240000'
then tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( ScheduledBasicEndDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_dats( dats_tims_to_tstmp(ScheduledBasicEndDate, ScheduledBasicEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as ScheduledBasicEndDate,
case ScheduledBasicEndTime when '240000'
then tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( ScheduledBasicEndDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_tims( dats_tims_to_tstmp(ScheduledBasicEndDate, ScheduledBasicEndTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as ScheduledBasicEndTime,
case MaintOrderReferenceTime when '240000'
then cast(dats_tims_to_tstmp( dats_add_days( MaintOrderReferenceDate, 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( MaintOrderReferenceDate, MaintOrderReferenceTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL') as timestamp preserving type)
end as MaintOrderReferenceDateTime,
case MaintOrderReferenceTime when '240000'
then tstmp_to_dats( dats_tims_to_tstmp(dats_add_days( MaintOrderReferenceDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_dats( dats_tims_to_tstmp(MaintOrderReferenceDate, MaintOrderReferenceTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as MaintOrderReferenceDate,
case MaintOrderReferenceTime when '240000'
then tstmp_to_tims( dats_tims_to_tstmp(dats_add_days( MaintOrderReferenceDate, 1, 'NULL'), cast( '000000' as abap.tims ),
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
else tstmp_to_tims( dats_tims_to_tstmp(MaintOrderReferenceDate, MaintOrderReferenceTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client, 'NULL'), 'UTC', $session.client, 'NULL' )
end as MaintOrderReferenceTime,
MainWorkCompletedDateTime,
MaintenanceNotification,
OrdIsNotSchedldAutomatically,
WorkCenterInternalID as MainWorkCenterInternalID,
WorkCenterTypeCode as MainWorkCenterTypeCode,
_MainWorkCenter.WorkCenter as MainWorkCenter,
_MainWorkCenter.Plant as MainWorkCenterPlant,
ControllingArea,
//ServiceDetails for MOVE team
ServiceDocumentType,
ServiceDocument,
ServiceDocumentItem,
//ServiceDetails for MOVE team
MaintenancePlanningPlant,
Assembly,
MaintOrdProcessPhaseCode,
MaintOrdProcessSubPhaseCode,
CompanyCode,
BusinessArea,
ReferenceElement,
FunctionalArea,
AdditionalDeviceData,
Equipment,
MaintenanceOrderPlanningCode,
MaintenancePlannerGroup,
MaintenanceActivityType,
MaintPriority,
MaintPriorityType,
OrderProcessingGroup,
ProfitCenter,
ResponsibleCostCenter,
CostingSheet,
ConditionUsage,
ConditionApplication,
Currency,
MaintenanceRevision,
cast ( SerialNumber as vdm_eam_gernr ) as SerialNumber,
Material as Product,
SuperiorProjectNetwork,
OperationSystemCondition,
@ObjectModel.foreignKey.association: '_WBSElement'
cast ( I_MaintenanceOrder.WBSElementInternalID as ps_s4_pspnr ) as WBSElementInternalID,
cast( ProjectInternalID as ps_s4_proj_pspnr ) as ProjectInternalID,
// Location Assignment
cast ( _LocationAccountAssignment.WBSElementInternalID as ps_s4_pspnr preserving type ) as LocAcctAssgmtWBSElmntIntID,
_LocationAccountAssignment.CostCenter,
ControllingObjectClass,
cast ( _LocationAccountAssignment.FunctionalLocation as vdm_eam_tplnr ) as FunctionalLocation,
-- Location Data
_LocationAccountAssignment.MaintenancePlant,
_LocationAccountAssignment.AssetLocation,
_LocationAccountAssignment.AssetRoom,
_LocationAccountAssignment.PlantSection,
_LocationAccountAssignment.ABCIndicator,
_LocationAccountAssignment.MaintObjectFreeDefinedAttrib,
_LocationAccountAssignment.WorkCenterInternalID,
_LocationAccountAssignment.WorkCenterTypeCode,
_LocationAccountAssignment._WorkCenter.WorkCenter,
_LocationAccountAssignment.BusinessArea as LocAcctAssgmtBusinessArea,
_LocationAccountAssignment.SettlementOrder,
_LocationAccountAssignment.MasterFixedAsset,
_LocationAccountAssignment.FixedAsset,
_LocationAccountAssignment.StandingOrderNumber,
_LocationAccountAssignment.SalesOrganization,
_LocationAccountAssignment.DistributionChannel,
_LocationAccountAssignment.OrganizationDivision,
_LocationAccountAssignment.ControllingArea as LocAcctAssgmtControllingArea,
_LocationAccountAssignment.CompanyCode as LocAcctAssgmtCompanyCode,
MaintenanceOrderInternalID,
MaintenanceItemObjectList,
I_MaintenanceOrder.MaintObjectLocAcctAssgmtNmbr,
@Feature: 'EAM_ORD_CHANGE_SETTLMT_PROFILE' //should be featured?
_CtrlgObjectSettlementRule.ControllingSettlementProfile,
BasicSchedulingType,
LatestAcceptableCompletionDate,
MaintOrdPersonResponsible,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
LastChangeByUser,
@ObjectModel.readOnly: null
LastChangeDateTime,
CreatedByUser,
case CreationTime when '240000'
then cast(dats_tims_to_tstmp( dats_add_days( CreationDate, 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( CreationDate, CreationTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,'NULL') as timestamp preserving type)
end as MaintOrderCreationDateTime,
OrderHasLongText,
MaintOrderProcessingContext,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
MaintenanceOrderOverheadCode,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
PlannedCostsCostingVariant,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
ActualCostsCostingVariant,
/*Mainteannce Plan*/
MaintenancePlan,
MaintenanceCall,
MaintenanceItem,
LeadingOrder,
TaskListType,
TaskListGroup,
TaskListGroupCounter,
/*Mainteannce Plan*/
// associations
_MaintenanceOrderOperation,
_MaintOrderObjectListItem,
_MaintOrderSettlmtDistrRule,
_MaintOrderSettlmtDistrRule_2,
_MaintenanceOrderPhaseControl,
_MaintenanceOrderPartner,
_FunctionalLocationLabel,
_MaintenanceOrderType,
_EAMProcessPhase,
_EAMProcessSubPhase,
_Equipment,
_LocationAccountAssignment,
_WBSElement,
_MainWorkCenter,
_MaintenancePlanningPlant,
_MaintenancePlannerGroup,
_Assembly,
_OperationSystemCondition,
_LocAcctAssgmtWBSElement,
_ProjectBasicData,
_CtrlgObjectSettlementRule,
_MaintenancePriorityType,
_MaintenancePriority,
_MaintOrderTypeControlParam,
// associations of texts
_EAMProcessPhaseText,
_EAMProcessSubPhaseText,
_MaintOrderTechObj,
_MaintenanceActivityType,
_MaintenanceNotification,
_MaintOrdPlngDegreeCode,
_ProfitCenter,
_StatusObjectActiveStatus,
_MaintenanceOrderLongText,
_ControllingObjectClass,
_ResponsibleCostCenter,
_ControllingArea,
_CompanyCode,
_BusinessArea,
_PersonResponsible,
_MaintenanceRevision,
@Feature: 'EAM_F5241_HEADER_SCHED_DETAILS'
_BasicSchedulingType,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
_CostingSheetProcedure,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
_OverheadCode,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
_PlannedCostingVariant,
@Feature: 'EAM_F5241_HEADER_CONTROL_DATA'
_ActualCostingVariant
}
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CTRLGOBJECTSETTLEMENTRULE",
"I_LOCATIONACCOUNTASSIGNMENT",
"I_MAINTENANCEORDER",
"I_WORKCENTER"
],
"ASSOCIATED":
[
"I_BUSINESSAREA",
"I_COMPANYCODE",
"I_CONTROLLINGAREA",
"I_CONTROLLINGOBJECTCLASS",
"I_COSTCENTER",
"I_COSTINGSHEETPROCEDURE",
"I_COSTINGVARIANT",
"I_CTRLGOBJECTSETTLEMENTRULE",
"I_EAMPROCESSPHASE",
"I_EAMPROCESSPHASETEXT",
"I_EAMPROCESSSUBPHASE",
"I_EAMPROCESSSUBPHASETEXT",
"I_EQUIPMENT",
"I_FUNCTIONALLOCATIONLABEL",
"I_INTERNALORDEROVERHEADCODEVH",
"I_LOCATIONACCOUNTASSIGNMENT",
"I_MAINTENANCEACTIVITYTYPE",
"I_MAINTENANCENOTIFICATION",
"I_MAINTENANCEPLANNERGROUP",
"I_MAINTENANCEREVISION",
"I_MAINTOPERATIONSYSTCONDITION",
"I_MAINTORDERTECHOBJ",
"I_MAINTORDERTYPECONTROLPARAM",
"I_MAINTORDPLNGDEGREECODE",
"I_MATERIAL",
"I_ORDERTYPE",
"I_PERSONWORKAGREEMENT_1",
"I_PLANT",
"I_PMNOTIFICATIONPRIORITY",
"I_PMNOTIFICATIONPRIORITYTYPE",
"I_PROFITCENTER",
"I_PROJECTBASICDATA",
"I_SCHEDULINGTYPE",
"I_STATUSOBJECTACTIVESTATUS",
"I_WBSELEMENTBASICDATA",
"I_WORKCENTER",
"R_MAINTENANCEORDERLONGTEXTTP",
"R_MAINTENANCEORDEROPERATIONTP",
"R_MAINTENANCEORDERPARTNERTP",
"R_MAINTORDERPHASECONTROLTP",
"R_MAINTORDERSETTLMTDISTRRULETP",
"R_MAINTORDOBJECTLISTITEMTP",
"R_MAINTORDSETTLMTDISTRRULETP_2"
],
"BASE":
[
"I_MAINTENANCEORDER"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/