P_RO_SAFTSLSINVITEMTOTAL
Sales invoice items
P_RO_SAFTSLSINVITEMTOTAL is a Consumption CDS View that provides data about "Sales invoice items" in SAP S/4HANA. It reads from 5 data sources (I_OperationalAcctgDocItem, I_RO_SAFTDocumentTypeMap, P_RO_SAFTInvoiceItemCount, P_RO_SAFTJournalEntryItemExc, P_RO_SAFTOplAcctgDocItmExc) and exposes 13 fields with key fields StatryRptCategory, StatryRptgEntity, StatryRptRunID, SourceLedger, Ledger. Part of development package GLO_FIN_IS_SAFT_RO.
Data Sources (5)
| Source | Alias | Join Type |
|---|---|---|
| I_OperationalAcctgDocItem | Bseg | inner |
| I_RO_SAFTDocumentTypeMap | DocType | inner |
| P_RO_SAFTInvoiceItemCount | P_RO_SAFTInvoiceItemCount | inner |
| P_RO_SAFTJournalEntryItemExc | P_RO_SAFTJournalEntryItemExc | inner |
| P_RO_SAFTOplAcctgDocItmExc | P_RO_SAFTOplAcctgDocItmExc | inner |
Parameters (1)
| Name | Type | Default |
|---|---|---|
| P_AlternativeGLAccountIsUsed | saft_ro_alt_gl_account_flag |
Annotations (7)
| Name | Value | Level | Field |
|---|---|---|---|
| VDM.viewType | #CONSUMPTION | view | |
| VDM.private | true | view | |
| ObjectModel.usageType.serviceQuality | #X | view | |
| ObjectModel.usageType.sizeCategory | #XL | view | |
| ObjectModel.usageType.dataClass | #MIXED | view | |
| AccessControl.personalData.blocking | #NOT_REQUIRED | view | |
| AccessControl.authorizationCheck | #NOT_REQUIRED | view |
Fields (13)
| Key | Field | Source Table | Source Field | Description |
|---|---|---|---|---|
| KEY | StatryRptCategory | Log | StatryRptCategory | |
| KEY | StatryRptgEntity | Log | StatryRptgEntity | |
| KEY | StatryRptRunID | Log | StatryRptRunID | |
| KEY | SourceLedger | Acdoca | SourceLedger | |
| KEY | Ledger | Acdoca | Ledger | |
| KEY | CompanyCode | Acdoca | CompanyCode | |
| KEY | FiscalYear | Acdoca | FiscalYear | |
| KEY | AccountingDocument | Acdoca | AccountingDocument | |
| KEY | LedgerGLLineItem | Acdoca | LedgerGLLineItem | |
| AccountingDocumentItem | Acdoca | AccountingDocumentItem | ||
| AccountingDocumentType | Acdoca | AccountingDocumentType | ||
| PostingDate | Acdoca | PostingDate | ||
| CompanyCodeCurrency | Acdoca | CompanyCodeCurrency |
@VDM.viewType: #CONSUMPTION
@VDM.private:true
@ObjectModel.usageType.serviceQuality: #X
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.dataClass: #MIXED
@AccessControl.personalData.blocking: #NOT_REQUIRED
@AccessControl.authorizationCheck: #NOT_REQUIRED
define view entity P_RO_SAFTSLSINVITEMTOTAL
with parameters
P_AlternativeGLAccountIsUsed : saft_ro_alt_gl_account_flag
as select distinct from I_StRpJournalEntryHeaderLog as Log
inner join P_RO_SAFTJournalEntryItemExc(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed) as Acdoca on Acdoca.AccountingDocument = Log.AccountingDocument
and Acdoca.CompanyCode = Log.CompanyCode
and Acdoca.FiscalYear = Log.FiscalYear
inner join I_RO_SAFTDocumentTypeMap as DocType on DocType.AccountingDocumentType = Acdoca.AccountingDocumentType
and DocType.CompanyCode = Acdoca.CompanyCode
inner join I_OperationalAcctgDocItem as Bseg on Bseg.AccountingDocument = Acdoca.AccountingDocument
and Bseg.CompanyCode = Acdoca.CompanyCode
and Bseg.FiscalYear = Acdoca.FiscalYear
and Bseg.AccountingDocumentItem = Acdoca.AccountingDocumentItem
and Bseg.PostingDate = Acdoca.PostingDate
and Bseg.AccountingDocumentType = Acdoca.AccountingDocumentType
inner join P_RO_SAFTOplAcctgDocItmExc(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed) as BsegV on BsegV.AccountingDocument = Acdoca.AccountingDocument
and BsegV.CompanyCode = Acdoca.CompanyCode
and BsegV.FiscalYear = Acdoca.FiscalYear
and BsegV.PostingDate = Acdoca.PostingDate
and BsegV.AccountingDocumentType = Acdoca.AccountingDocumentType
inner join P_RO_SAFTInvoiceItemCount(P_AlternativeGLAccountIsUsed: $parameters.P_AlternativeGLAccountIsUsed) as reporting_country_filter on reporting_country_filter.AccountingDocument = Acdoca.AccountingDocument
and reporting_country_filter.CompanyCode = Acdoca.CompanyCode
and reporting_country_filter.FiscalYear = Acdoca.FiscalYear
and reporting_country_filter.PostingDate = Acdoca.PostingDate
and reporting_country_filter.AccountingDocumentType = Acdoca.AccountingDocumentType
and reporting_country_filter.TaxType = 'A'
left outer to one join I_RO_SAFTSpecialGLIndicator as SpecialGLIndicator on Acdoca.CompanyCode = SpecialGLIndicator.CompanyCode
and Acdoca.FinancialAccountType = SpecialGLIndicator.AccountType
and Acdoca.SpecialGLCode = SpecialGLIndicator.SpecialGLCode
left outer to one join I_RO_SAFTSpecialGLIndicator as SpecialGLIndicatorF on BsegV.CompanyCode = SpecialGLIndicatorF.CompanyCode
and BsegV.FinancialAccountType = SpecialGLIndicatorF.AccountType
and BsegV.SpecialGLCode = SpecialGLIndicatorF.SpecialGLCode
{
key Log.StatryRptCategory,
key Log.StatryRptgEntity,
key Log.StatryRptRunID,
key Acdoca.SourceLedger,
key Acdoca.Ledger,
key Acdoca.CompanyCode,
key Acdoca.FiscalYear,
key Acdoca.AccountingDocument,
key Acdoca.LedgerGLLineItem,
Acdoca.AccountingDocumentItem,
Acdoca.AccountingDocumentType,
Acdoca.PostingDate,
//@Semantics.currencyCode:true
Acdoca.CompanyCodeCurrency,
// Negative posting is already considered in P_Acdoca_COM1 and the indicator
// is also adjusted there accordingly thus there is no need to do it here
case Acdoca.DebitCreditCode
when 'H' then 'C'
else 'D'
end as DebitCreditCode,
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case when Bseg.OriglTaxBaseAmountInCoCodeCrcy <> 0 then
case when Bseg.DebitCreditCode = 'H' or (Bseg.DebitCreditCode = 'S' and Bseg.IsNegativePosting = 'X')
then -1 * abs(Bseg.OriglTaxBaseAmountInCoCodeCrcy)
else abs(Bseg.OriglTaxBaseAmountInCoCodeCrcy) end
when Acdoca.DebitCreditCode = 'H' then -1 * Acdoca.AmountInCompanyCodeCurrency
else Acdoca.AmountInCompanyCodeCurrency
end as AmountInCompanyCodeCurrency
}
/**
The same WHERE condition is used in C_RO_SAFTSalesInvoiceItemC and P_RO_SAFTInvoiceItemCount.
If you adjust it here keep in mind to update in other places as well.
**/
where
DocType.RO_SAFTSourceDocumentType = '01'
and BsegV.FinancialAccountType = 'D'
and
// exclude customer vendor lines
(
Acdoca.FinancialAccountType <> 'D'
or Acdoca.SpecialGLCode = SpecialGLIndicator.SpecialGLCode
)
and(
Acdoca.FinancialAccountType <> 'K'
or Acdoca.SpecialGLCode = SpecialGLIndicator.SpecialGLCode
)
and
// exclude VAT lines
Bseg.AccountingDocumentItemType <> 'T'
and SpecialGLIndicatorF.SpecialGLCode is null
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