P_PH_PaytOpnReceivablePyblItm

DDL: P_PH_PAYTOPNRECEIVABLEPYBLITM SQL: PPHPATYOPRPITM Type: view COMPOSITE

P_PH_PaytOpnReceivablePyblItm is a Composite CDS View in SAP S/4HANA. It reads from 3 data sources (I_OperationalAcctgDocItem, I_OperationalAcctgDocItem, I_AccountingDocument) and exposes 32 fields with key fields CompanyCode, AccountingDocument, FiscalYear, AccountingDocumentItem, InvoiceReference.

Data Sources (3)

SourceAliasJoin Type
I_OperationalAcctgDocItem _InvoiceApArItem left_outer
I_OperationalAcctgDocItem _PaymentOpenItem from
I_AccountingDocument _SourceInvoiceHeader inner

Annotations (7)

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

Fields (32)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_OperationalAcctgDocItem CompanyCode
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
KEY AccountingDocumentItem I_OperationalAcctgDocItem AccountingDocumentItem
KEY InvoiceReference I_OperationalAcctgDocItem AccountingDocument
KEY InvoiceReferenceFiscalYear I_OperationalAcctgDocItem FiscalYear
KEY InvoiceItemReference I_OperationalAcctgDocItem AccountingDocumentItem
BusinessPlace
PostingDate I_OperationalAcctgDocItem PostingDate
AccountingDocumentType I_OperationalAcctgDocItem AccountingDocumentType
FinancialAccountType I_OperationalAcctgDocItem FinancialAccountType
IsUsedInPaymentTransaction I_OperationalAcctgDocItem IsUsedInPaymentTransaction
ClearingAccountingDocument I_OperationalAcctgDocItem ClearingJournalEntry
ClearingDocFiscalYear I_OperationalAcctgDocItem ClearingJournalEntryFiscalYear
ClearingDate I_OperationalAcctgDocItem ClearingDate
GLAccount I_OperationalAcctgDocItem GLAccount
DebitCreditCodeendasDebitCreditCode
Customer I_OperationalAcctgDocItem Customer
Supplier I_OperationalAcctgDocItem Supplier
DocumentReferenceID I_AccountingDocument DocumentReferenceID
TransactionCurrency I_OperationalAcctgDocItem TransactionCurrency
AmountInTransactionCurrency I_OperationalAcctgDocItem AmountInTransactionCurrency
CompanyCodeCurrency I_OperationalAcctgDocItem CompanyCodeCurrency
AmountInCompanyCodeCurrency I_OperationalAcctgDocItem AmountInCompanyCodeCurrency
AdditionalCurrency1 I_OperationalAcctgDocItem AdditionalCurrency1
AmountInAdditionalCurrency1 I_OperationalAcctgDocItem AmountInAdditionalCurrency1
AdditionalCurrency2 I_OperationalAcctgDocItem AdditionalCurrency2
AmountInAdditionalCurrency2 I_OperationalAcctgDocItem AmountInAdditionalCurrency2
InvoiceCompanyCode I_OperationalAcctgDocItem CompanyCode
_Supplier I_OperationalAcctgDocItem _Supplier
_Customer I_OperationalAcctgDocItem _Customer
_OneTimeAccountBP I_OperationalAcctgDocItem _OneTimeAccountBP
@AbapCatalog.sqlViewName: 'PPHPATYOPRPITM'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK
@VDM.private: true
@VDM.viewType: #COMPOSITE
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_PH_PaytOpnReceivablePyblItm
  as select from    I_OperationalAcctgDocItem as _PaymentOpenItem
    inner join I_AccountingDocument      as _SourceInvoiceHeader on  _PaymentOpenItem.InvoiceReference                    = _SourceInvoiceHeader.AccountingDocument
                                                                                                      and _PaymentOpenItem.InvoiceReferenceFiscalYear      = _SourceInvoiceHeader.FiscalYear
                                                                                                      and _PaymentOpenItem.CompanyCode                         = _SourceInvoiceHeader.CompanyCode

   left outer join I_OperationalAcctgDocItem as _InvoiceApArItem   on   _InvoiceApArItem.AccountingDocument         = _PaymentOpenItem.InvoiceReference
                                                                                                  and _InvoiceApArItem.FiscalYear                          = _PaymentOpenItem.InvoiceReferenceFiscalYear
                                                                                                  and _InvoiceApArItem.CompanyCode                    = _PaymentOpenItem.CompanyCode
                                                                                                  and _InvoiceApArItem.AccountingDocumentItem   = _PaymentOpenItem.InvoiceItemReference
{
  key _PaymentOpenItem.CompanyCode,
  key _PaymentOpenItem.AccountingDocument,
  key _PaymentOpenItem.FiscalYear,
  key _PaymentOpenItem.AccountingDocumentItem,
  key _InvoiceApArItem.AccountingDocument as InvoiceReference,
  key _InvoiceApArItem.FiscalYear as InvoiceReferenceFiscalYear,
  key _InvoiceApArItem.AccountingDocumentItem as InvoiceItemReference,
  
      coalesce( _PaymentOpenItem.BusinessPlace, _InvoiceApArItem.BusinessPlace) as BusinessPlace,
      _PaymentOpenItem.PostingDate,
      _PaymentOpenItem.AccountingDocumentType,
      _PaymentOpenItem.FinancialAccountType,
      _PaymentOpenItem.IsUsedInPaymentTransaction,
      _PaymentOpenItem.ClearingJournalEntry           as ClearingAccountingDocument,
      _PaymentOpenItem.ClearingJournalEntryFiscalYear as ClearingDocFiscalYear,
      _PaymentOpenItem.ClearingDate,
      _PaymentOpenItem.GLAccount,
      case _PaymentOpenItem.IsNegativePosting
          when 'X' then
              case _PaymentOpenItem.DebitCreditCode
                  when 'H' then 'S'
                  when 'S' then 'H'
              end
          else _PaymentOpenItem.DebitCreditCode
      end as DebitCreditCode,
//      _PaymentOpenItem.DebitCreditCode,

      _PaymentOpenItem.Customer,
      _PaymentOpenItem.Supplier,
      _SourceInvoiceHeader.DocumentReferenceID,

      _PaymentOpenItem.TransactionCurrency,
      _PaymentOpenItem.AmountInTransactionCurrency,
      _PaymentOpenItem.CompanyCodeCurrency,
      _PaymentOpenItem.AmountInCompanyCodeCurrency,
      _PaymentOpenItem.AdditionalCurrency1,
      _PaymentOpenItem.AmountInAdditionalCurrency1,
      _PaymentOpenItem.AdditionalCurrency2,
      _PaymentOpenItem.AmountInAdditionalCurrency2,
      
      _InvoiceApArItem.CompanyCode as InvoiceCompanyCode,
      _PaymentOpenItem._Supplier,
      _PaymentOpenItem._Customer,
      _InvoiceApArItem._OneTimeAccountBP
}
where _PaymentOpenItem.IsUsedInPaymentTransaction  = 'X'
   and _PaymentOpenItem.InvoiceReference != ''
   // Exclude payment document which is a clearing document

 and not( _PaymentOpenItem.ClearingJournalEntry = _PaymentOpenItem.AccountingDocument
         and _PaymentOpenItem.ClearingJournalEntryFiscalYear    = _PaymentOpenItem.FiscalYear
             )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTINGDOCUMENT",
"I_OPERATIONALACCTGDOCITEM"
],
"ASSOCIATED":
[
"I_CUSTOMER",
"I_ONETIMEACCOUNTBP",
"I_SUPPLIER"
],
"BASE":
[
"I_OPERATIONALACCTGDOCITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/