P_RO_SAFTInvoiceItemCount
FI Document Relevant for Sales/Purchase Invoice Section
P_RO_SAFTInvoiceItemCount is a Consumption CDS View that provides data about "FI Document Relevant for Sales/Purchase Invoice Section" in SAP S/4HANA. It reads from 3 data sources (P_RO_SAFTOplAcctgDocItmExc, I_TaxCode, P_RO_SAFTROTAXCODE) and exposes 6 fields with key fields CompanyCode, FiscalYear, AccountingDocument. Part of development package GLO_FIN_IS_SAFT_RO.
Data Sources (3)
| Source | Alias | Join Type |
|---|---|---|
| P_RO_SAFTOplAcctgDocItmExc | P_RO_SAFTOplAcctgDocItmExc | from |
| I_TaxCode | taxcode | inner |
| P_RO_SAFTROTAXCODE | TaxCountry | inner |
Parameters (1)
| Name | Type | Default |
|---|---|---|
| P_AlternativeGLAccountIsUsed | saft_ro_alt_gl_account_flag |
Annotations (10)
| Name | Value | Level | Field |
|---|---|---|---|
| AbapCatalog.sqlViewName | PROSAFTINVITMCNT | view | |
| AbapCatalog.compiler.compareFilter | true | view | |
| AbapCatalog.preserveKey | true | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view | |
| VDM.viewType | #CONSUMPTION | view | |
| VDM.private | true | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.serviceQuality | #A | view | |
| ObjectModel.usageType.dataClass | #TRANSACTIONAL | view | |
| ClientHandling.algorithm | #SESSION_VARIABLE | view |
@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
Learn More
- What Is a CDS View in SAP S/4HANA?
- Types of CDS Views: Basic, Composite, Consumption, and Transactional
- SAP Tables vs CDS Views — Key Differences
- Understanding Data Lineage in SAP S/4HANA
- VDM (Virtual Data Model) in SAP S/4HANA Explained
- CDS View Annotations — A Complete Guide
- CDS View Field Mapping and Associations
- Understanding the SAP S/4HANA Data Model
- CDS View Extensions and Custom Fields in SAP S/4HANA
- Released APIs and Stability Contracts in SAP S/4HANA