P_ServiceOrderFulfillment

DDL: P_SERVICEORDERFULFILLMENT Type: view COMPOSITE

P_ServiceOrderFulfillment is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_ServiceDocument) and exposes 57 fields with key fields ServiceObjectType, ServiceDocument.

Data Sources (1)

SourceAliasJoin Type
I_ServiceDocument ServiceDoc from

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PSRVORDFU view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.private true view
VDM.viewType #COMPOSITE view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.sizeCategory #XXL view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (57)

KeyFieldSource TableSource FieldDescription
KEY ServiceObjectType I_ServiceDocument ServiceObjectType
KEY ServiceDocument I_ServiceDocument ServiceDocument
ServiceDocumentDescription I_ServiceDocument ServiceDocumentDescription
ServiceDocumentUUID I_ServiceDocument ServiceDocumentUUID
ServiceDocumentType I_ServiceDocument ServiceDocumentType
NrItemSitnendasSitnNumberOfInstances
SoldToParty I_ServiceDocument SoldToParty
SoldToPartyCountry I_ServiceDocument SoldToPartyCountry
SoldToPartyRegion I_ServiceDocument SoldToPartyRegion
SalesOrganization I_ServiceDocument SalesOrganization
SalesGroup I_ServiceDocument SalesGroup
SalesOffice I_ServiceDocument SalesOffice
DistributionChannel I_ServiceDocument DistributionChannel
Division I_ServiceDocument Division
ResponsibleEmployee I_ServiceDocument ResponsibleEmployee
ServiceDocNetAmount I_ServiceDocument ServiceDocNetAmount
TotalNetAmount
ServiceDocumentStatus I_ServiceDocument ServiceDocumentStatus
ServiceDocumentHasError I_ServiceDocument ServiceDocumentHasError
ServiceDocumentIsReleased I_ServiceDocument ServiceDocumentIsReleased
ServiceDocBillingStatus I_ServiceDocument ServiceDocBillingStatus
ServiceDocIsReleasedForBilling I_ServiceDocument ServiceDocIsReleasedForBilling
ServiceDocumentIsRejected I_ServiceDocument ServiceDocumentIsRejected
ServiceDocumentIsOpen I_ServiceDocument ServiceDocumentIsOpen
ServiceDocumentIsQuotation I_ServiceDocument ServiceDocumentIsQuotation
TransactionCurrency I_ServiceDocument TransactionCurrency
SalesGroupOrgUnitID I_ServiceDocument SalesGroupOrgUnitID
SalesOfficeOrgUnitID I_ServiceDocument SalesOfficeOrgUnitID
SalesOrganizationOrgUnitID I_ServiceDocument SalesOrganizationOrgUnitID
ServiceOrganization I_ServiceDocument ServiceOrganization
BillingDocumentType billingDoc BillingDocumentType
_SoldToParty I_ServiceDocument _SoldToParty
_SoldToPartyCountry I_ServiceDocument _SoldToPartyCountry
_SoldToPartyRegion I_ServiceDocument _SoldToPartyRegion
_SalesOrganization I_ServiceDocument _SalesOrganization
_SalesGroup I_ServiceDocument _SalesGroup
_SalesOffice I_ServiceDocument _SalesOffice
_DistributionChannel I_ServiceDocument _DistributionChannel
_Division I_ServiceDocument _Division
_RespEmployee I_ServiceDocument _RespEmployee
_ServiceDocumentStatus I_ServiceDocument _ServiceDocumentStatus
_SrvcDocLifecycleStatus I_ServiceDocument _SrvcDocLifecycleStatus
_ServiceDocHasError I_ServiceDocument _ServiceDocHasError
_ServiceDocBillingStatus I_ServiceDocument _ServiceDocBillingStatus
_ServiceDocumentType I_ServiceDocument _ServiceDocumentType
_ServiceObjType I_ServiceDocument _ServiceObjType
_ServiceDocumentIsOpen I_ServiceDocument _ServiceDocumentIsOpen
_SrvcDocIsRelForBillgSts I_ServiceDocument _SrvcDocIsRelForBillgSts
_SalesGroupOrgUnit I_ServiceDocument _SalesGroupOrgUnit
_SalesOfficeOrgUnit I_ServiceDocument _SalesOfficeOrgUnit
_SalesOrganizationOrgUnit I_ServiceDocument _SalesOrganizationOrgUnit
_ServiceOrganizationOrgUnit I_ServiceDocument _ServiceOrganizationOrgUnit
_SalesGroupOrgUnit_2 I_ServiceDocument _SalesGroupOrgUnit_2
_SalesOfficeOrgUnit_2 I_ServiceDocument _SalesOfficeOrgUnit_2
_SalesOrganizationOrgUnit_2 I_ServiceDocument _SalesOrganizationOrgUnit_2
_ServiceOrganizationOrgUnit_2 I_ServiceDocument _ServiceOrganizationOrgUnit_2
_BillingDocumentType billingDoc _BillingDocumentType
@AbapCatalog:
{
    sqlViewName: 'PSRVORDFU',
    compiler.compareFilter: true,
    preserveKey: true   
}
@VDM: {
    private: true,
    viewType: #COMPOSITE
}
@ObjectModel: {
   usageType: {
     dataClass:      #MIXED,
     serviceQuality: #D,
     sizeCategory:   #XXL
   }
}
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
//@EndUserText.label: 'View for service order fulfillment monitor'

define view P_ServiceOrderFulfillment as select from I_ServiceDocument as ServiceDoc
    left outer to many join  I_BillingDocument as billingDoc  on ServiceDoc.ServiceDocument = billingDoc.DocumentReferenceID
                                                     and billingDoc.BillingDocumentIsTemporary = ' '
    left outer to one join P_SrvcTransWthSituation as srvcSit on ServiceDoc.ServiceDocument = srvcSit.ServiceDocument
    
  //  association [1..*] to ZSituationCountForSrvcDoc as _SitCount on _SitCount.ServiceObjectType =  ServiceDoc.ServiceObjectType

   //                                                     and  _SitCount.ServiceDocument = ServiceDoc.ServiceDocument


{
  //  key cast('SrvcOrd' as crms4_ana_srvc_proc_def)                        as ServiceProcessCategoryID,

    key ServiceDoc.ServiceObjectType,
    key ServiceDoc.ServiceDocument,
    ServiceDoc.ServiceDocumentDescription,
    ServiceDoc.ServiceDocumentUUID,
    ServiceDoc.ServiceDocumentType,
 //   srvcSit.ServiceDocumentItem,

 //   srvcSit.ServiceDocumentItemUUID,

    
 //   case ServiceDoc.ServiceDocumentIsOpen

 //       when 'X'

 //           then 

 //               case ServiceDoc.ServiceDocumentIsReleased

 //                   when 'X'

 //                   then cast('SRVCORD020' as crms4_ana_srvc_proc_phase)

 //                   else cast('SRVCORD010' as crms4_ana_srvc_proc_phase)

 //               end

 //           else 

 //               case ServiceDoc.ServiceDocBillingStatus

 //                   when 'C'

 //                   then cast('SRVCORD040' as crms4_ana_srvc_proc_phase)

 //                   else cast('SRVCORD030' as crms4_ana_srvc_proc_phase)

 //               end

 //        end                                                               as ServiceProcessPhaseName,

     // as the srvcSit.NrHeaderSitn column is null (because the join condition is not met), we need to add the case statement to get the desired result    

     case when srvcSit.NrHeaderSitn is not null 
          then  srvcSit.NrItemSitn + srvcSit.NrHeaderSitn   
          else  srvcSit.NrItemSitn end                                      as SitnNumberOfInstances,
     ServiceDoc.SoldToParty,
     ServiceDoc.SoldToPartyCountry,
     ServiceDoc.SoldToPartyRegion,
     ServiceDoc.SalesOrganization,
     ServiceDoc.SalesGroup,
     ServiceDoc.SalesOffice,
     ServiceDoc.DistributionChannel,
     ServiceDoc.Division,
     ServiceDoc.ResponsibleEmployee,
     ServiceDoc.ServiceDocNetAmount,
     sum(billingDoc.TotalNetAmount) as TotalNetAmount,
     ServiceDoc.ServiceDocumentStatus,
     ServiceDoc.ServiceDocumentHasError,
     ServiceDoc.ServiceDocumentIsReleased,
     ServiceDoc.ServiceDocBillingStatus,
     ServiceDoc.ServiceDocIsReleasedForBilling,
     ServiceDoc.ServiceDocumentIsRejected,
     ServiceDoc.ServiceDocumentIsOpen,
     ServiceDoc.ServiceDocumentIsQuotation,
     ServiceDoc.TransactionCurrency,
     
     //DCL Purpose

     ServiceDoc.SalesGroupOrgUnitID,
     ServiceDoc.SalesOfficeOrgUnitID,
     ServiceDoc.SalesOrganizationOrgUnitID,
     ServiceDoc.ServiceOrganization,     
     billingDoc.BillingDocumentType,
     
     //associations

     ServiceDoc._SoldToParty,
     ServiceDoc._SoldToPartyCountry,
     ServiceDoc._SoldToPartyRegion,
     ServiceDoc._SalesOrganization,
     ServiceDoc._SalesGroup,
     ServiceDoc._SalesOffice,
     ServiceDoc._DistributionChannel,
     ServiceDoc._Division,
     ServiceDoc._RespEmployee,
     @API.element.releaseState: #DEPRECATED
     @API.element.successor: '_SrvcDocLifecycleStatus'
     ServiceDoc._ServiceDocumentStatus,
     ServiceDoc._SrvcDocLifecycleStatus,     
     ServiceDoc._ServiceDocHasError,
     ServiceDoc._ServiceDocBillingStatus,
     ServiceDoc._ServiceDocumentType,
     ServiceDoc._ServiceObjType,
     ServiceDoc._ServiceDocumentIsOpen,
     ServiceDoc._SrvcDocIsRelForBillgSts,
     
     ServiceDoc._SalesGroupOrgUnit,
     ServiceDoc._SalesOfficeOrgUnit,
     ServiceDoc._SalesOrganizationOrgUnit,
     ServiceDoc._ServiceOrganizationOrgUnit,
     
     ServiceDoc._SalesGroupOrgUnit_2,
     ServiceDoc._SalesOfficeOrgUnit_2,
     ServiceDoc._SalesOrganizationOrgUnit_2,
     ServiceDoc._ServiceOrganizationOrgUnit_2,
          
    // _SitCount

     billingDoc._BillingDocumentType
     
    
} where ServiceDoc.ServiceObjectType = 'BUS2000116' //and ServiceDoc.ServiceDocument = '8000001625'

  group by ServiceDoc.ServiceDocument,
           ServiceDoc.ServiceDocumentDescription,
           // srvcSit.NrItemSitn,

     ServiceDoc.SoldToParty,
     ServiceDoc.SoldToPartyCountry,
     ServiceDoc.SoldToPartyRegion,
     ServiceDoc.SalesOrganization,
     ServiceDoc.SalesGroup,
     ServiceDoc.SalesOffice,
     ServiceDoc.DistributionChannel,
     ServiceDoc.Division,
     ServiceDoc.ResponsibleEmployee,
     ServiceDoc.ServiceDocNetAmount,
     ServiceDoc.ServiceDocumentStatus,
     ServiceDoc.ServiceDocumentHasError,
     ServiceDoc.ServiceDocumentIsReleased,
     ServiceDoc.ServiceDocBillingStatus,
     ServiceDoc.ServiceDocIsReleasedForBilling,
     ServiceDoc.ServiceDocumentIsRejected,
     ServiceDoc.ServiceDocumentIsOpen,
     ServiceDoc.ServiceDocumentIsQuotation,
     ServiceDoc.ServiceObjectType,
    // srvcSit.ServiceDocumentItem,

    // srvcSit.ServiceDocumentItemUUID,

     ServiceDoc.ServiceDocumentUUID,
     ServiceDoc.ServiceDocumentType,
     ServiceDoc.SalesGroupOrgUnitID,
     ServiceDoc.SalesOfficeOrgUnitID,
     ServiceDoc.SalesOrganizationOrgUnitID,
     ServiceDoc.ServiceOrganization,
     billingDoc.BillingDocumentType,
     ServiceDoc.TransactionCurrency,
     srvcSit.NrItemSitn,
     srvcSit.NrHeaderSitn
             //and billingDoc.OverallBillingStatus != 'A'

/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_BILLINGDOCUMENT",
"I_SERVICEDOCUMENT",
"P_SRVCTRANSWTHSITUATION"
],
"ASSOCIATED":
[
"I_BILLINGDOCUMENTTYPE",
"I_BUSINESSPARTNER",
"I_COUNTRY",
"I_CUSTMGMTBUSOBJTYPE",
"I_DISTRIBUTIONCHANNEL",
"I_DIVISION",
"I_REGION",
"I_SALESGROUP",
"I_SALESOFFICE",
"I_SALESORGANIZATION",
"I_SALESORGANIZATIONUNIT",
"I_SERVICEDOCBILLINGSTATUS",
"I_SERVICEDOCERRORSTATUS",
"I_SERVICEDOCOPENSTATUS",
"I_SERVICEDOCUMENTSTATUS",
"I_SERVICEDOCUMENTTYPE",
"I_SRVCDOCLIFECYCLESTATUS",
"I_SRVCDOCRELFORBILLGSTS",
"I_SRVCMGMTORGANIZATIONUNIT"
],
"BASE":
[
"I_BILLINGDOCUMENT",
"I_SERVICEDOCUMENT"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/