P_SDDocumentTotalItems

DDL: P_SDDOCUMENTTOTALITEMS SQL: PSDDOCTOTITEMS Type: view CONSUMPTION Package: ODATA_SD_RETURN_V2

Total Number of Items in Reference Document

P_SDDocumentTotalItems is a Consumption CDS View that provides data about "Total Number of Items in Reference Document" in SAP S/4HANA. It reads from 2 data sources (I_BillingDocumentItem, I_SalesDocumentItemBasic) and exposes 3 fields with key field DocumentCount. Part of development package ODATA_SD_RETURN_V2.

Data Sources (2)

SourceAliasJoin Type
I_BillingDocumentItem BillingDocumentItem union_all
I_SalesDocumentItemBasic SalesDocumentItem from

Annotations (7)

NameValueLevelField
ClientHandling.algorithm #SESSION_VARIABLE view
AbapCatalog.sqlViewName PSDDOCTOTITEMS view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
VDM.private true view
VDM.viewType #CONSUMPTION view
AccessControl.authorizationCheck #NOT_REQUIRED view

Fields (3)

KeyFieldSource TableSource FieldDescription
KEY DocumentCount I_SalesDocumentItemBasic SalesDocument
BillingDocumentasDocumentCount
DocumentItemCount
@ClientHandling.algorithm: #SESSION_VARIABLE
@AbapCatalog.sqlViewName: 'PSDDOCTOTITEMS'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@VDM.private:true
@VDM.viewType: #CONSUMPTION
@AccessControl.authorizationCheck: #NOT_REQUIRED

define view P_SDDocumentTotalItems
  as select from           I_SalesDocumentItemBasic   as SalesDocumentItem
    left outer to one join I_SalesDocumentBasic       as SalesDocument            on  SalesDocument.SalesDocument = SalesDocumentItem.SalesDocument
    left outer to one join I_SalesDocumentCopyControl as SalesDocumentCopyControl on  SalesDocumentCopyControl.SourceSalesDocumentType = SalesDocument.SalesDocumentType
                                                                                  and SalesDocumentCopyControl.ReferenceItemCategory   = SalesDocumentItem.SalesDocumentItemCategory
                                                                                  and SalesDocumentCopyControl.TargetSalesDocumentType = 'CBAR'
{
  key SalesDocumentItem.SalesDocument as DocumentCount,
      count(*)                        as DocumentItemCount
}
group by
  SalesDocumentItem.SalesDocument

union all

select from              I_BillingDocumentItem      as BillingDocumentItem
  left outer to one join I_BillingDocument          as BillingDocument          on  BillingDocument.BillingDocument = BillingDocumentItem.BillingDocument
  left outer to one join I_SalesDocumentCopyControl as SalesDocumentCopyControl on  SalesDocumentCopyControl.SourceBillingDocumentType = BillingDocument.BillingDocumentType
                                                                                and SalesDocumentCopyControl.ReferenceItemCategory     = BillingDocumentItem.SalesDocumentItemCategory
                                                                                and SalesDocumentCopyControl.TargetSalesDocumentType   = 'CBAR'
{
  key BillingDocumentItem.BillingDocument as DocumentCount,
      count(*)                            as DocumentItemCount
}
group by
  BillingDocumentItem.BillingDocument