P_AU_StRpPTRPaidInvcSPP is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_AU_StRpPTRSmallBusinessIdn, I_OperationalAcctgDocItem) and exposes 10 fields with key fields CompanyCode, AccountingDocument, FiscalYear.
@AbapCatalog.sqlViewName: 'PAUSRPTRISPP'
@AbapCatalog.compiler.compareFilter: true@AbapCatalog.preserveKey: true@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.private: true@VDM.viewType: #COMPOSITE@ClientHandling.algorithm : #SESSION_VARIABLEdefineview P_AU_StRpPTRPaidInvcSPP
withparameters
P_FromReportingDate : figen_rep_date_from,
P_ToReportingDate : figen_rep_date_to
asselectdistinctfrom I_JournalEntry as JournalEntry
innerjoin I_OperationalAcctgDocItem as OperationalAcctgDocItem on JournalEntry.CompanyCode = OperationalAcctgDocItem.CompanyCode
and JournalEntry.AccountingDocument = OperationalAcctgDocItem.AccountingDocument
and JournalEntry.FiscalYear = OperationalAcctgDocItem.FiscalYear
innerjoin I_AU_StRpPTRSmallBusinessIdn as _PTRSmallBusiness on OperationalAcctgDocItem.CompanyCode = _PTRSmallBusiness.CompanyCode
and OperationalAcctgDocItem.Supplier = _PTRSmallBusiness.Supplier
and _PTRSmallBusiness.FromReportingDate = $parameters.P_FromReportingDate
{
key JournalEntry.CompanyCode,
key OperationalAcctgDocItem.AccountingDocument,
key OperationalAcctgDocItem.FiscalYear,
OperationalAcctgDocItem.PaymentTerms,
_PTRSmallBusiness.Supplier,
OperationalAcctgDocItem.CashDiscount1Days,
OperationalAcctgDocItem.CashDiscount2Days,
OperationalAcctgDocItem.NetPaymentDays,
OperationalAcctgDocItem.CashDiscount1Percent,
OperationalAcctgDocItem.CashDiscount2Percent
}
where
JournalEntry.ReverseDocument is initial
and OperationalAcctgDocItem.FinancialAccountType = 'K' // koart = K for vendors
and(
JournalEntry.PostingDate between $parameters.P_FromReportingDate and $parameters.P_ToReportingDate
or OperationalAcctgDocItem.ClearingDate between :P_FromReportingDate and :P_ToReportingDate
)
and( //Fully Paid Invoices
(
OperationalAcctgDocItem.ClearingAccountingDocument isnot initial
and OperationalAcctgDocItem.ClearingDate between :P_FromReportingDate and :P_ToReportingDate
and OperationalAcctgDocItem.ClearingAccountingDocument isnot initial
and OperationalAcctgDocItem.ClearingAccountingDocument <> OperationalAcctgDocItem.AccountingDocument
and OperationalAcctgDocItem.SpecialGLCode is initial //UMSKZ - special GL indicator should be blank to remove the down payment documents
and OperationalAcctgDocItem.IsUsedInPaymentTransaction is initial // for reversal documents , AUGDT and AUGBL gets filled in the payment document
)
)
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_AU_STRPPTRSMALLBUSINESSIDN",
"I_JOURNALENTRY",
"I_OPERATIONALACCTGDOCITEM"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/