@AccessControl.authorizationCheck: #MANDATORY
@AccessControl.personalData.blocking: #('TRANSACTIONAL_DATA')
@EndUserText.label: 'Service contracts for customer 360'
@Metadata.ignorePropagatedAnnotations: true
@Search.searchable: true
@ObjectModel: {
usageType: {
dataClass: #MIXED,
serviceQuality: #C,
sizeCategory: #XXL
}
}
@VDM.viewType: #CONSUMPTION
@Metadata.allowExtensions: true
define view entity C_Customer360ServiceContract
as select from I_ServiceDocumentEnhcd as ServiceContract
inner join I_Customer360BusDocSetting as Customer360BusDocSetting on Customer360BusDocSetting.Cust360BusDocCategory = 'SVC'
and Customer360BusDocSetting.BusinessDocumentIsEnabled = 'X'
association [0..1] to I_CustMgmtLifecycleUserStsText as _CustMgmtLifecycleUserStsText on $projection.ServiceContractStatus = _CustMgmtLifecycleUserStsText.CustMgmtLifecycleUserStatus
and _CustMgmtLifecycleUserStsText.Language = $session.system_language
association [1] to I_ServiceDocumentStatusText as _ServiceDocumentStatusText on $projection.ServiceContractStatus = _ServiceDocumentStatusText.ServiceDocumentStatus
and _ServiceDocumentStatusText.Language = $session.system_language
association [0..1] to C_ServiceDocumentShipToPartyVH as _ShipToParty on $projection.ShipToParty = _ShipToParty.BusinessPartner
association [0..1] to C_ServiceDocumentShipToPartyVH as _BillToParty on $projection.BillToParty = _BillToParty.BusinessPartner
association [0..1] to C_ServiceDocumentPayerVH as _PayerParty on $projection.PayerParty = _PayerParty.BusinessPartner
association [0..1] to C_SrvcMgmtRespEmplQuickVw as _ResponsibleEmployeeQuickView on $projection.RespEmployeeBusinessPartnerId = _ResponsibleEmployeeQuickView.BusinessPartner
association [0..1] to I_BusinessSolutionOrderStdVH as _SolutionOrderVH on $projection.RefBusinessSolutionOrder = _SolutionOrderVH.BusinessSolutionOrder
{
@ObjectModel.readOnly: true
@Consumption.semanticObject: 'ServiceContract'
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Search.ranking: #HIGH
key ServiceContract.ServiceDocument as ServiceContract,
ServiceContract.SoldToParty,
case ServiceContract.ServiceDocumentHasError
when 'X' then 1
when ' ' then 3
else 3
end as SrvcContrErrStsCriticality,
@ObjectModel.text.element: ['ServiceDocumentHasErrorName']
@Semantics.booleanIndicator: true
ServiceContract.ServiceDocumentHasError as ServiceContractHasError,
@UI.hidden: true
ServiceContract._ServiceDocHasError._ServiceDocHasErrorText[1:Language = $session.system_language].ServiceDocumentHasErrorName,
@ObjectModel.text.element: [ 'ServiceContractStatusName' ]
ServiceContract.ServiceDocumentStatus as ServiceContractStatus,
case
when ServiceContract._ServiceDocumentType.StatusProfile <> '' and _CustMgmtLifecycleUserStsText.CustMgmtLifecycleUserStatus <> ''
then _CustMgmtLifecycleUserStsText.CustMgmtLifecycleUserStsName
when ServiceContract._ServiceDocumentType.StatusProfile = ''
then _ServiceDocumentStatusText.ServiceDocumentStatusName
else _ServiceDocumentStatusText.ServiceDocumentStatusName
end as ServiceContractStatusName,
@EndUserText.label: 'Contract Start'
@Consumption.filter.selectionType: #INTERVAL
tstmp_to_dats( ServiceContract.ServiceContractStartDateTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,
'NULL' ) as ServiceContractStartDate,
@EndUserText.label: 'Contract End'
@Consumption.filter.selectionType: #INTERVAL
tstmp_to_dats( ServiceContract.ServiceContractEndDateTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,
'NULL' ) as ServiceContractEndDate,
@Search.defaultSearchElement: true
@EndUserText.label: 'External Reference'
ServiceContract.PurchaseOrderByCustomer,
@Consumption.filter.hidden: true
@Semantics.amount.currencyCode: 'TransactionCurrency'
ServiceContract.ServiceDocNetAmount as ServiceContractNetAmount,
ServiceContract.TransactionCurrency,
@UI.textArrangement: #TEXT_ONLY
@EndUserText.label: 'Cancellation Status'
@ObjectModel.text.element: ['ServiceContractCanclnStsName']
ServiceContract.ServiceContractCanclnSts,
@UI.hidden: true
ServiceContract._ServiceContractCanclnSts._ServiceContractCanclnStsTxt[1:Language = $session.system_language].ServiceContractCanclnStsName,
@UI.textArrangement: #TEXT_FIRST
@ObjectModel.text.element: [ 'ShipToPartyName' ]
ServiceContract.ShipToParty,
@UI.textArrangement: #TEXT_FIRST
@ObjectModel.text.element: [ 'BillToPartyName' ]
ServiceContract.BillToParty,
@UI.textArrangement: #TEXT_FIRST
@ObjectModel.text.element: [ 'PayerPartyName' ]
ServiceContract.PayerParty,
@UI.textArrangement: #TEXT_ONLY
@ObjectModel.text.element: ['ServiceDocBillingStatusName']
ServiceContract.ServiceDocBillingStatus,
@UI.hidden: true
ServiceContract._ServiceDocBillingStatus._ServiceDocBillingStatusText[1:Language = $session.system_language].ServiceDocBillingStatusName,
@EndUserText.label: 'Credit Status'
@ObjectModel.text.element: ['SrvcDocCreditStatusText']
@UI: {
dataFieldDefault:[{criticality: 'SrvcContrCrdtStsCriticality',criticalityRepresentation: #WITHOUT_ICON}],
textArrangement: #TEXT_ONLY
}
ServiceContract.SrvcDocCreditStatus as SrvcContrCreditStatus,
@UI.hidden: true
ServiceContract._SrvcDocCreditStatus._SrvcDocCreditStatusText[1:Language = $session.system_language].SrvcDocCreditStatusText,
@EndUserText.label: 'Description'
@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Consumption.filter.hidden: true
ServiceContract.ServiceDocumentDescription as ServiceContractDescription,
@UI.hidden: true
case ServiceContract.SrvcDocCreditStatus
when 'A' then 0
when 'B' then 3
when 'C' then 1
when 'D' then 2
else 0
end as SrvcContrCrdtStsCriticality,
@EndUserText.label: 'Sales Organization'
@ObjectModel.text.element: ['SalesOrganizationName']
ServiceContract.SalesOrganization,
@UI.hidden: true
ServiceContract._SalesOrganization._Text[1:Language = $session.system_language].SalesOrganizationName,
@EndUserText.label: 'Sales Office'
@ObjectModel.text.element: ['SalesOfficeName']
ServiceContract.SalesOffice,
@UI.hidden: true
ServiceContract._SalesOffice._Text[1:Language = $session.system_language].SalesOfficeName,
@EndUserText.label: 'Sales Group'
@ObjectModel.text.element: ['SalesGroupName']
ServiceContract.SalesGroup,
@UI.hidden: true
ServiceContract._SalesGroup._Text[1:Language = $session.system_language].SalesGroupName,
@EndUserText.label: 'Distribution Channel'
@ObjectModel.text.element: ['DistributionChannelName']
ServiceContract.DistributionChannel,
@UI.hidden: true
ServiceContract._DistributionChannel._Text[1:Language = $session.system_language].DistributionChannelName,
@EndUserText.label: 'Division'
@ObjectModel.text.element: ['DivisionName']
ServiceContract.Division,
@UI.hidden: true
ServiceContract._Division._Text[1:Language = $session.system_language].DivisionName,
@EndUserText.label: 'Earliest Start'
@Consumption.filter.selectionType: #INTERVAL
tstmp_to_dats( ServiceContract.SrvcContrEarliestStartDateTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,
'NULL' ) as SrvcContrEarliestStartDate,
@EndUserText.label: 'Latest End'
@Consumption.filter.selectionType: #INTERVAL
tstmp_to_dats( ServiceContract.SrvcContrLatestEndDateTime,
abap_system_timezone( $session.client,'NULL' ),
$session.client,
'NULL' ) as SrvcContrLatestEndDate,
@EndUserText.label: 'Employee Responsible'
@ObjectModel.foreignKey.association: '_ResponsibleEmployeeQuickView'
@UI.textArrangement: #TEXT_ONLY
@ObjectModel.text.element: ['ResponsibleEmployeeName']
@Consumption: {
semanticObject: 'ResponsibleEmployeeQuickView'
}
ServiceContract.ResponsibleEmployee as RespEmployeeBusinessPartnerId,
@Consumption.filter.hidden: true
@Semantics.amount.currencyCode: 'TransactionCurrency'
ServiceContract.ServiceDocGrossAmount as ServiceContractGrossAmount,
@Consumption.filter.selectionType: #INTERVAL
ServiceContract.PostingDate,
@Consumption.filter.hidden: true
@UI.hidden: true
_ResponsibleEmployeeQuickView.BusinessPartnerName as ResponsibleEmployeeName,
@EndUserText.label: 'Solution Order'
@Search.defaultSearchElement: true
@Consumption.semanticObject: 'BusinessSolutionOrder'
@ObjectModel.text.element: ['BusSolnOrdDescription']
ServiceContract.RefBusinessSolutionOrder,
@UI.hidden: true
_SolutionOrderVH.BusSolnOrdDescription as BusSolnOrdDescription,
@ObjectModel.text.element: ['ServiceDocumentTypeName']
ServiceContract.ServiceDocumentType,
@UI.hidden: true
ServiceContract._ServiceDocumentType._ServiceDocumentTypeText[1:Language = $session.system_language].ServiceDocumentTypeName,
ServiceContract.ServiceDocumentTemplateType,
// Hidden Fields
@UI.hidden: true
_BillToParty.BusinessPartnerName as BillToPartyName,
@UI.hidden: true
_ShipToParty.BusinessPartnerName as ShipToPartyName,
@UI.hidden: true
_PayerParty.BusinessPartnerName as PayerPartyName,
@UI.hidden: true
ServiceContract._ServiceDocHasError,
@UI.hidden: true
ServiceContract._SalesOrganization,
@UI.hidden: true
_ResponsibleEmployeeQuickView,
@UI.hidden: true
_PayerParty,
@UI.hidden: true
_BillToParty,
@UI.hidden: true
_ShipToParty,
// DCL Fields
@UI.hidden: true
ServiceContract.SalesOrganizationOrgUnitID,
@UI.hidden: true
ServiceContract.SalesOfficeOrgUnitID,
@UI.hidden: true
ServiceContract.SalesGroupOrgUnitID,
@UI.hidden: true
ServiceContract.ServiceOrganization,
@UI.hidden: true
ServiceContract.ServiceObjectType
}
where
ServiceContract.ServiceObjectType = 'BUS2000112'
and ServiceContract.ServiceDocumentTemplateType = ''
and ServiceContract.ServiceDocCreationDateTime > dats_tims_to_tstmp(dats_add_days( tstmp_to_dats(tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL'), - Customer360BusDocSetting.BusDocumentDurationInDays, 'INITIAL'), tstmp_to_tims(tstmp_current_utctimestamp(), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL'), abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL')
and ServiceContract.ServiceDocCreationDateTime <= tstmp_current_utctimestamp()