C_Customer360ServiceContract

DDL: C_CUSTOMER360SERVICECONTRACT Type: view_entity CONSUMPTION Package: ODATA_SD_ADVNCD_CUSTOMER360

Service contracts for customer 360

C_Customer360ServiceContract is a Consumption CDS View that provides data about "Service contracts for customer 360" in SAP S/4HANA. It reads from 2 data sources (I_Customer360BusDocSetting, I_ServiceDocumentEnhcd) and exposes 55 fields with key field ServiceContract. It has 7 associations to related views. It is exposed through 1 OData service (SD_ADVNCD_CUSTOMER360). Part of development package ODATA_SD_ADVNCD_CUSTOMER360.

Data Sources (2)

SourceAliasJoin Type
I_Customer360BusDocSetting Customer360BusDocSetting inner
I_ServiceDocumentEnhcd ServiceContract from

Associations (7)

CardinalityTargetAliasCondition
[0..1] I_CustMgmtLifecycleUserStsText _CustMgmtLifecycleUserStsText $projection.ServiceContractStatus = _CustMgmtLifecycleUserStsText.CustMgmtLifecycleUserStatus and _CustMgmtLifecycleUserStsText.Language = $session.system_language
[1] I_ServiceDocumentStatusText _ServiceDocumentStatusText $projection.ServiceContractStatus = _ServiceDocumentStatusText.ServiceDocumentStatus and _ServiceDocumentStatusText.Language = $session.system_language
[0..1] C_ServiceDocumentShipToPartyVH _ShipToParty $projection.ShipToParty = _ShipToParty.BusinessPartner
[0..1] C_ServiceDocumentShipToPartyVH _BillToParty $projection.BillToParty = _BillToParty.BusinessPartner
[0..1] C_ServiceDocumentPayerVH _PayerParty $projection.PayerParty = _PayerParty.BusinessPartner
[0..1] C_SrvcMgmtRespEmplQuickVw _ResponsibleEmployeeQuickView $projection.RespEmployeeBusinessPartnerId = _ResponsibleEmployeeQuickView.BusinessPartner
[0..1] I_BusinessSolutionOrderStdVH _SolutionOrderVH $projection.RefBusinessSolutionOrder = _SolutionOrderVH.BusinessSolutionOrder

Annotations (9)

NameValueLevelField
AccessControl.authorizationCheck #MANDATORY view
EndUserText.label Service contracts for customer 360 view
Metadata.ignorePropagatedAnnotations true view
Search.searchable true view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #C view
ObjectModel.usageType.sizeCategory #XXL view
VDM.viewType #CONSUMPTION view
Metadata.allowExtensions true view

OData Services (1)

ServiceBindingVersionContractRelease
SD_ADVNCD_CUSTOMER360 SD_ADVNCD_CUSTOMER360 V4 C1 NOT_RELEASED

Fields (55)

KeyFieldSource TableSource FieldDescription
KEY ServiceContract I_ServiceDocumentEnhcd ServiceDocument
SoldToParty I_ServiceDocumentEnhcd SoldToParty
ServiceContractHasError I_ServiceDocumentEnhcd ServiceDocumentHasError
ServiceDocumentHasErrorName
ServiceContractStatus I_ServiceDocumentEnhcd ServiceDocumentStatus
clientNULLasServiceContractStartDate Contract Start
clientNULLasServiceContractEndDate Contract End
PurchaseOrderByCustomer I_ServiceDocumentEnhcd PurchaseOrderByCustomer External Reference
ServiceContractNetAmount I_ServiceDocumentEnhcd ServiceDocNetAmount
TransactionCurrency I_ServiceDocumentEnhcd TransactionCurrency
ServiceContractCanclnSts I_ServiceDocumentEnhcd ServiceContractCanclnSts Cancellation Status
ServiceContractCanclnStsName
ShipToParty I_ServiceDocumentEnhcd ShipToParty
BillToParty I_ServiceDocumentEnhcd BillToParty
PayerParty I_ServiceDocumentEnhcd PayerParty
ServiceDocBillingStatus I_ServiceDocumentEnhcd ServiceDocBillingStatus
ServiceDocBillingStatusName
SrvcContrCreditStatus I_ServiceDocumentEnhcd SrvcDocCreditStatus Credit Status
SrvcDocCreditStatusText
ServiceContractDescription I_ServiceDocumentEnhcd ServiceDocumentDescription Description
SalesOrganization I_ServiceDocumentEnhcd SalesOrganization Sales Organization
SalesOrganizationName
SalesOffice I_ServiceDocumentEnhcd SalesOffice Sales Office
SalesOfficeName
SalesGroup I_ServiceDocumentEnhcd SalesGroup Sales Group
SalesGroupName
DistributionChannel I_ServiceDocumentEnhcd DistributionChannel Distribution Channel
DistributionChannelName
Division I_ServiceDocumentEnhcd Division Division
DivisionName
clientNULLasSrvcContrEarliestStartDate Earliest Start
clientNULLasSrvcContrLatestEndDate Latest End
RespEmployeeBusinessPartnerId I_ServiceDocumentEnhcd ResponsibleEmployee Employee Responsible
ServiceContractGrossAmount I_ServiceDocumentEnhcd ServiceDocGrossAmount
PostingDate I_ServiceDocumentEnhcd PostingDate
ResponsibleEmployeeName _ResponsibleEmployeeQuickView BusinessPartnerName
RefBusinessSolutionOrder I_ServiceDocumentEnhcd RefBusinessSolutionOrder Solution Order
BusSolnOrdDescription _SolutionOrderVH BusSolnOrdDescription
ServiceDocumentType I_ServiceDocumentEnhcd ServiceDocumentType
ServiceDocumentTypeName
ServiceDocumentTemplateType I_ServiceDocumentEnhcd ServiceDocumentTemplateType
BillToPartyName _BillToParty BusinessPartnerName
ShipToPartyName _ShipToParty BusinessPartnerName
PayerPartyName _PayerParty BusinessPartnerName
_ServiceDocHasError I_ServiceDocumentEnhcd _ServiceDocHasError
_SalesOrganization I_ServiceDocumentEnhcd _SalesOrganization
_ResponsibleEmployeeQuickView _ResponsibleEmployeeQuickView
_PayerParty _PayerParty
_BillToParty _BillToParty
_ShipToParty _ShipToParty
SalesOrganizationOrgUnitID I_ServiceDocumentEnhcd SalesOrganizationOrgUnitID
SalesOfficeOrgUnitID I_ServiceDocumentEnhcd SalesOfficeOrgUnitID
SalesGroupOrgUnitID I_ServiceDocumentEnhcd SalesGroupOrgUnitID
ServiceOrganization I_ServiceDocumentEnhcd ServiceOrganization
ServiceObjectType I_ServiceDocumentEnhcd ServiceObjectType
@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()