P_AU_StRpPTRPaidInvcSPP

DDL: P_AU_STRPPTRPAIDINVCSPP SQL: PAUSRPTRISPP Type: view COMPOSITE

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.

Data Sources (2)

SourceAliasJoin Type
I_AU_StRpPTRSmallBusinessIdn _PTRSmallBusiness inner
I_OperationalAcctgDocItem OperationalAcctgDocItem inner

Parameters (2)

NameTypeDefault
P_FromReportingDate figen_rep_date_from
P_ToReportingDate figen_rep_date_to

Annotations (7)

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

Fields (10)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode JournalEntry CompanyCode
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
PaymentTerms I_OperationalAcctgDocItem PaymentTerms
Supplier I_AU_StRpPTRSmallBusinessIdn Supplier
CashDiscount1Days I_OperationalAcctgDocItem CashDiscount1Days
CashDiscount2Days I_OperationalAcctgDocItem CashDiscount2Days
NetPaymentDays I_OperationalAcctgDocItem NetPaymentDays
CashDiscount1Percent I_OperationalAcctgDocItem CashDiscount1Percent
CashDiscount2Percent I_OperationalAcctgDocItem CashDiscount2Percent
@AbapCatalog.sqlViewName: 'PAUSRPTRISPP'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm : #SESSION_VARIABLE
define view P_AU_StRpPTRPaidInvcSPP
  with parameters
    P_FromReportingDate : figen_rep_date_from,
    P_ToReportingDate   : figen_rep_date_to
  as select distinct from I_JournalEntry               as JournalEntry
    inner join            I_OperationalAcctgDocItem    as OperationalAcctgDocItem on  JournalEntry.CompanyCode        = OperationalAcctgDocItem.CompanyCode
                                                                                  and JournalEntry.AccountingDocument = OperationalAcctgDocItem.AccountingDocument
                                                                                  and JournalEntry.FiscalYear         = OperationalAcctgDocItem.FiscalYear
    inner join            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     is not initial
         and OperationalAcctgDocItem.ClearingDate               between :P_FromReportingDate and :P_ToReportingDate
         and OperationalAcctgDocItem.ClearingAccountingDocument is not 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

       )
  )