P_RO_SAFTINVOICEITEMCOUNT
FI Document Relevant for Sales/Purchase Invoice Section
P_RO_SAFTINVOICEITEMCOUNT is a CDS View in S/4HANA. FI Document Relevant for Sales/Purchase Invoice Section. 6 CDS views read from this table.
CDS Views using this table (6)
| View | Type | Join | VDM | Description |
|---|---|---|---|---|
| C_RO_SAFTPurInvoiceItemC | view | inner | CONSUMPTION | Purchase invoice item for RO SAFT - Cube |
| C_RO_SAFTSalesInvoiceItemC | view | inner | CONSUMPTION | Sales invoice item for RO SAFT - Cube |
| P_RO_SAFTPurInvHdr1 | view | inner | CONSUMPTION | Pur Inv Header for RO SAFT Base 1 |
| P_RO_SAFTPURINVITEMTOTAL | view_entity | inner | CONSUMPTION | Purchase invoice items |
| P_RO_SAFTSalInvHdr1 | view | inner | CONSUMPTION | Sales Inv Header for RO SAFT Base 1 |
| P_RO_SAFTSLSINVITEMTOTAL | view_entity | inner | CONSUMPTION | Sales invoice items |
@AbapCatalog.sqlViewName: 'PROSAFTINVITMCNT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@VDM.private:true
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #A
@ObjectModel.usageType.dataClass: #TRANSACTIONAL
@ClientHandling.algorithm: #SESSION_VARIABLE
// This view lists documents that have at least one line item which is not a tax line item nor customer/supplier line item.
define view P_RO_SAFTInvoiceItemCount
with parameters
P_AlternativeGLAccountIsUsed : saft_ro_alt_gl_account_flag
as select from P_RO_SAFTOplAcctgDocItmExc(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed) as Bseg
inner join P_RO_SAFTROTAXCODE as TaxCountry on TaxCountry.CompanyCodeCountry = 'RO'
and TaxCountry.TargetTaxCode = Bseg.TaxCode
and TaxCountry.TaxRateValidityEndDate >= Bseg.PostingDate
and TaxCountry.TaxRateValidityStartDate <= Bseg.PostingDate
inner join I_TaxCode as taxcode on taxcode.TaxCalculationProcedure = TaxCountry.CostingSheetProcedure
and taxcode.TaxCode = Bseg.TaxCode
left outer to one join I_RO_SAFTSpecialGLIndicator as SpecialGLIndicator on Bseg.CompanyCode = SpecialGLIndicator.CompanyCode
and Bseg.FinancialAccountType = SpecialGLIndicator.AccountType
and Bseg.SpecialGLCode = SpecialGLIndicator.SpecialGLCode
{
key Bseg.CompanyCode,
key Bseg.FiscalYear,
key Bseg.AccountingDocument,
Bseg.PostingDate,
Bseg.AccountingDocumentType,
taxcode.TaxType
}
/**
The same WHERE condition is used in C_RO_SAFTSalesInvoiceItemC and C_RO_SAFTPurInvoiceItemC.
If you adjust it here keep in mind to update in other places as well.
**/
where
// exclude customer vendor lines
(
Bseg.FinancialAccountType <> 'D'
or Bseg.SpecialGLCode = SpecialGLIndicator.SpecialGLCode
)
and(
Bseg.FinancialAccountType <> 'K'
or Bseg.SpecialGLCode = SpecialGLIndicator.SpecialGLCode
)
and
// exclude VAT lines
Bseg.AccountingDocumentItemType <> 'T'
group by
Bseg.CompanyCode,
Bseg.FiscalYear,
Bseg.AccountingDocument,
Bseg.PostingDate,
Bseg.AccountingDocumentType,
taxcode.TaxType