@EndUserText.label: 'In-House Repair Item'
@VDM: {
viewType: #TRANSACTIONAL,
lifecycle.contract.type: #SAP_INTERNAL_API
}
@AccessControl: {
authorizationCheck: #CHECK,
personalData.blocking: #('TRANSACTIONAL_DATA'),
privilegedAssociations: ['_RepairOrder', '_RepairQuotation', '_InhReprItmNrOfOpnMaintOrd', '_SrvcDocCreditStatus']
}
@ObjectModel: {
semanticKey: ['InHouseRepair', 'InHouseRepairItem'],
representativeKey: 'InHouseRepairItem',
usageType: {serviceQuality: #B, sizeCategory: #L, dataClass: #TRANSACTIONAL}
}
@Metadata: {
ignorePropagatedAnnotations: true
}
/*+[hideWarning] { "IDS" : [ "CALCULATED_FIELD_CHECK" ] }*/
define view entity I_InHouseRepairItemTP
as select from I_InHouseRepairItem as ihritem
association to parent I_InHouseRepairTP as _InHouseRepairTP on $projection.InHouseRepair = _InHouseRepairTP.InHouseRepair
composition [0..*] of R_InhRepairItemNoteTP as _InhRepairItemNoteTP
composition [0..*] of R_InhRepairItmFUPCustReturnTP as _InhRepairItmFUPCustReturnTP
association [1..1] to I_InHouseRepair as _InHouseRepair on _InHouseRepair.CustMgmtObjectType = 'BUS2000256'
and $projection.InHouseRepair = _InHouseRepair.InHouseRepair
association [0..1] to I_SitnInstceIndicator as _SitnInstceIndicator on _SitnInstceIndicator.SitnInstceAnchorObjectKey = $projection.InHouseRepairItemCharUUID
and _SitnInstceIndicator.SitnDefAnchorObject = 'InHouseRepairItemUUID'
association [1..1] to E_InHouseRepairItem as _Extension on _Extension.CustMgmtObjectType = 'BUS2000256'
and $projection.InHouseRepair = _Extension.InHouseRepair
and $projection.InHouseRepairItem = _Extension.InHouseRepairItem
association [0..1] to P_InhRepairItmNrOfOpenConf as _InhRepairItmNrOfOpenSrvcConf on $projection.InHouseRepair = _InhRepairItmNrOfOpenSrvcConf.InHouseRepair
and $projection.InHouseRepairItem = _InhRepairItmNrOfOpenSrvcConf.InHouseRepairItem
association [0..1] to R_InhRepairItmNrOfOpnMaintOrds as _InhReprItmNrOfOpnMaintOrd on $projection.InHouseRepairItemUUID = _InhReprItmNrOfOpnMaintOrd.InHouseRepairItemUUID
association [0..1] to I_InhRepairItmCustRetRelation as _CustomerReturnsItemReference on (
$projection.InHouseRepairItemCharUUID = _CustomerReturnsItemReference.ServiceDocumentItemPredecessor
and _CustomerReturnsItemReference.ServiceDocItmSuccssrBusObjType = 'VBAP'
)
or (
$projection.InHouseRepairItemCharUUID = _CustomerReturnsItemReference.ServiceDocumentItemSuccessor
and _CustomerReturnsItemReference.ServiceDocItmPrdcssrBusObjType = 'VBAP'
)
association [0..1] to R_InhRepairItemCreditStatus as _SrvcDocCreditStatus on _SrvcDocCreditStatus.CustMgmtObjectType = 'BUS2000256'
and _SrvcDocCreditStatus.InHouseRepair = $projection.InHouseRepair
and _SrvcDocCreditStatus.InHouseRepairItem = $projection.InHouseRepairItem
{
@ObjectModel: {
foreignKey.association: '_InHouseRepair'
}
key ihritem.InHouseRepair, //Header ID
key ihritem.InHouseRepairItem,
ihritem.InHouseRepairItemUUID,
ihritem.InHouseRepairItemCharUUID,
ihritem.CreationDateTime,
ihritem.CreatedByUser,
ihritem.LastChangeDateTime,
ihritem.LastChangedByUser,
ihritem.InhRepairItemObjectType, //Transaction Category, BUS2000257 (Item)
ihritem.InHouseRepairUUID,
@ObjectModel: {
foreignKey.association: '_InhRepairItemCategory'
}
ihritem.InhRepairItemCategory,
@ObjectModel: {
foreignKey.association: '_InhRepairItemStatus'
}
ihritem.InhRepairItemStatus,
@ObjectModel: {
foreignKey.association: '_InhRepairItemSuplmntyStatus'
}
ihritem.InhRepairItemSuplmntyStatus,
@ObjectModel: {
foreignKey.association: '_InhRepairItemAvailyStatus'
}
ihritem.InhRepairItemAvailyStatus,
ihritem.InhRepairItemDeliveryStatus,
@Semantics: {
booleanIndicator: true
}
@ObjectModel: {
foreignKey.association: '_InhRepairItemHasError'
}
ihritem.InhRepairItemHasError,
@Semantics: {
booleanIndicator: true
}
@ObjectModel: {
foreignKey.association: '_InhRepairItemIsOpen'
}
ihritem.InhRepairItemIsOpen,
ihritem.ProductUUID,
ihritem.OriginallyRequestedProduct, //Material Number (Alphanumeric key)
@ObjectModel: {
foreignKey.association: '_Product'
}
ihritem.Product, //Material Number (Alphanumeric key)
@ObjectModel: {
foreignKey.association: '_InhRepairReferenceEquipment'
}
ihritem.InhRepairReferenceEquipment,
//required for Equipment navigation - Target Mapping Parameter (MaintenanceObject-displayFactSheet)
case when not ihritem.InhRepairReferenceEquipment is initial
then cast('EAMS_EQUI' as eams_tec_obj_type_value)
end as TechObjIsEquipOrFuncnlLoc,
//required for Equipment navigation - Target Mapping Parameter (MaintenanceObject-displayFactSheet)
case when not ihritem.InhRepairReferenceEquipment is initial
then cast(ihritem.InhRepairReferenceEquipment as eams_tec_obj)
end as TechnicalObject,
ihritem.SerialNumber,
// Data for Quick View
_InHouseRepairTP.SoldToParty,
_InHouseRepairTP.ContactPerson,
_InHouseRepairTP.ShipToParty,
// These fields are required for the Service contract integration
_InHouseRepairTP.DistributionChannel,
_InHouseRepairTP.Division,
_InHouseRepairTP.SalesOrganization,
//Service Team
@ObjectModel: { text.element: ['RespyMgmtServiceTeamDesc'] }
case when ihritem._RepairOrder._SuccessorServiceTransaction._ServiceTeamHeader.TeamName is not null
then cast(ihritem._RepairOrder._SuccessorServiceTransaction._ServiceTeamHeader.TeamName as crms4_service_team_name_rm_lbl )
else cast(ihritem._RepairQuotation._SuccessorServiceTransaction._ServiceTeamHeader.TeamName as crms4_service_team_name_rm_lbl )
end as RespyMgmtServiceTeamName,
@Semantics.text: true
case when ihritem._RepairOrder._SuccessorServiceTransaction._ServiceTeamHeader.TeamName is not null
then cast( ihritem._RepairOrder._SuccessorServiceTransaction._ServiceTeamHeader._TeamDescription.TeamDescription as crms4_service_team_desc_rm_lbl )
else cast( ihritem._RepairQuotation._SuccessorServiceTransaction._ServiceTeamHeader._TeamDescription.TeamDescription as crms4_service_team_desc_rm_lbl )
end as RespyMgmtServiceTeamDesc,
//Number of Open Repair Confirmations
//The filter values of a selection variant on the UI cannot handle null values. Therefore we need to convert null values to integer 0 values.
case when _InhRepairItmNrOfOpenSrvcConf.NrOfOpnInhReprSrvcConf is null
then cast(0 as crms4_repa_nrof_open_repr_conf)
else _InhRepairItmNrOfOpenSrvcConf.NrOfOpnInhReprSrvcConf
end as NrOfOpnInhReprSrvcConf,
//Status used for front end level 0 changes based on system status
//We deliberatley have no else clause, because of better performance. This leads to a null value which is published as false by odata.
@Semantics.booleanIndicator: true
case ihritem._SrvcMgmtObjectStatus.SrvcMgmtObjectStatus
when 'I1002' then cast( 'X' as crms4_repa_stat_item_new preserving type ) end as InhRepairItemIsNew,
//Status used for front end level 0 changes based on system status
//We deliberatley have no else clause, because of better performance. This leads to a null value which is published as false by odata.
@Semantics.booleanIndicator: true
case ihritem._SrvcMgmtObjectStatus.SrvcMgmtObjectStatus
when 'I1003' then cast( 'X' as crms4_repa_stat_item_inprocess preserving type ) end as InhRepairItemIsInProcess,
//Status used for front end level 0 changes based on system status
//There are two options of calculating the completed status:
//1. You join with the status table and check for status “I1005”
//2. You negate the status “Is Open”, because this is the exact opposite of completed
//We decided for the second approach because it does not need a join and therefore has better performance.
//We deliberatley have no else clause, because of better performance. This leads to a null value which is published as false by odata.
@Semantics.booleanIndicator: true
case ihritem.InhRepairItemIsOpen
when '' then cast( 'X' as crms4_repa_stat_item_completed preserving type ) end as InhRepairItemIsCompleted,
//Number of Non-closed/Incomplete Maintenance Orders
_InhReprItmNrOfOpnMaintOrd,
ihritem.ReferenceCustomerReturnItem,
ihritem.RefRetsMgmtProcessItem,
ihritem.RefRetsMgmtProcItmQtySplit,
// Fields that are processed with the header segment (ORDERADM_H) in one order must be at the end
// of the field list. Otherwise, the logic of the mapping adapter used for one order RAP does not work properly.
ihritem.InhRepairType, //Transaction Type (Header), e.g. REP1
ihritem.PostingDate, //Creation date of the in-house repair
/* Associations */
ihritem._InhRepairItemCategory,
ihritem._InhRepairItemStatus,
ihritem._InhRepairItemSuplmntyStatus,
ihritem._InhRepairItemHasError,
ihritem._InhRepairItemIsOpen,
ihritem._InhRepairReferenceEquipment,
ihritem._Product,
_InHouseRepair,
_InHouseRepairTP,
_InhRepairItemNoteTP,
ihritem._RepairOrder,
ihritem._RepairQuotation,
// _ServiceQuotationStatus,
ihritem._SrvcMgmtObjectStatus,
_SitnInstceIndicator,
_SrvcDocCreditStatus,
ihritem._InhRepairItemAvailyStatus,
//text associations are no longer used in our projection views. therefore, we want to remove them.
//but these associations are still used in C1 released view ESH_N_INHOUSEREPAIR for our enterprise search modell
//therefore, removal is not possible
ihritem._ProductText,
ihritem._InhRepairReferenceEquipText,
ihritem._OutboundDelivery,
_CustomerReturnsItemReference,
_InhRepairItmFUPCustReturnTP
}
where
ihritem.CustMgmtObjectType = 'BUS2000256'
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_INHOUSEREPAIRITEM",
"I_INHOUSEREPAIRTP",
"I_INHREPAIRTRANSACTIONRELATION",
"I_RESPYMGMTTEAMDESCRIPTION",
"I_RESPYMGMTTEAMHEADERDETAIL",
"I_SERVICEDOCUMENT",
"I_SRVCMGMTOBJECTSTATUS",
"P_INHREPAIRITMNROFOPENCONF"
],
"ASSOCIATED":
[
"I_CUSTMGMTDOCITEMCATEGORY",
"I_EQUIPMENT",
"I_EQUIPMENTTEXT",
"I_INHOUSEREPAIR",
"I_INHOUSEREPAIRTP",
"I_INHREPAIRITEMAVAILYSTATUS",
"I_INHREPAIRITEMSTATUS",
"I_INHREPAIRITMCUSTRETRELATION",
"I_INHREPAIRTRANSACTIONRELATION",
"I_PRODUCT",
"I_PRODUCTTEXT",
"I_SERVICEDOCERRORSTATUS",
"I_SERVICEDOCOPENSTATUS",
"I_SITNINSTCEINDICATOR",
"I_SRVCMGMTOBJECTSTATUS",
"R_INHREPAIRITEMCREDITSTATUS",
"R_INHREPAIRITEMNOTETP",
"R_INHREPAIRITMFUPCUSTRETURNTP",
"R_INHREPAIRITMNROFOPNMAINTORDS"
],
"BASE":
[
"I_INHOUSEREPAIRITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/