P_PE_PurchaseOriginalJrnlEntry

DDL: P_PE_PURCHASEORIGINALJRNLENTRY SQL: PPEPUROJE Type: view CONSUMPTION Package: GLO_FIN_IS_PE

Original Journal Entry for Peru

P_PE_PurchaseOriginalJrnlEntry is a Consumption CDS View that provides data about "Original Journal Entry for Peru" in SAP S/4HANA. It reads from 2 data sources (I_GLAccountLineItemRawData, I_JournalEntry) and exposes 7 fields with key fields SourceLedger, CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem. Part of development package GLO_FIN_IS_PE.

Data Sources (2)

SourceAliasJoin Type
I_GLAccountLineItemRawData GLAccountLineItem inner
I_JournalEntry JournalEntry from

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName PPEPUROJE view
AbapCatalog.compiler.compareFilter true view
ClientHandling.algorithm #SESSION_VARIABLE view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.private true view
VDM.viewType #CONSUMPTION view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view

Fields (7)

KeyFieldSource TableSource FieldDescription
KEY SourceLedger I_GLAccountLineItemRawData SourceLedger
KEY CompanyCode I_GLAccountLineItemRawData CompanyCode
KEY FiscalYear I_GLAccountLineItemRawData FiscalYear
KEY AccountingDocument I_GLAccountLineItemRawData AccountingDocument
KEY LedgerGLLineItem I_GLAccountLineItemRawData LedgerGLLineItem
DocumentDate
DocumentReferenceID
@AbapCatalog.sqlViewName: 'PPEPUROJE'
@AbapCatalog.compiler.compareFilter: true
@ClientHandling.algorithm: #SESSION_VARIABLE
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private:true
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED

define view P_PE_PurchaseOriginalJrnlEntry
  as select from           I_JournalEntry             as JournalEntry

    inner join             I_GLAccountLineItemRawData as GLAccountLineItem    on  JournalEntry.CompanyCode        = GLAccountLineItem.CompanyCode
                                                                              and JournalEntry.AccountingDocument = GLAccountLineItem.AccountingDocument
                                                                              and JournalEntry.FiscalYear         = GLAccountLineItem.FiscalYear

    left outer to one join I_JournalEntry             as InvoiceReference     on  GLAccountLineItem.CompanyCode                = InvoiceReference.CompanyCode
                                                                              and GLAccountLineItem.InvoiceReference           = InvoiceReference.AccountingDocument
                                                                              and GLAccountLineItem.InvoiceReferenceFiscalYear = InvoiceReference.FiscalYear

    left outer to one join I_GLAccountLineItemRawData as ClearedLineItem      on  JournalEntry.CompanyCode             = ClearedLineItem.CompanyCode
                                                                              and JournalEntry.AccountingDocument      = ClearedLineItem.ClearingJournalEntry
                                                                              and JournalEntry.FiscalYear              = ClearedLineItem.ClearingJournalEntryFiscalYear
                                                                              and GLAccountLineItem.SourceLedger       = ClearedLineItem.SourceLedger
                                                                              and ClearedLineItem.FinancialAccountType = 'K'
                                                                              and ClearedLineItem.InvoiceReference     = ''
                                                                              and ( JournalEntry.AccountingDocument    <> ClearedLineItem.AccountingDocument
                                                                                 or JournalEntry.FiscalYear            <> ClearedLineItem.FiscalYear )

    left outer to one join I_JournalEntry             as OriginalJournalEntry on  ClearedLineItem.CompanyCode        = OriginalJournalEntry.CompanyCode
                                                                              and ClearedLineItem.AccountingDocument = OriginalJournalEntry.AccountingDocument
                                                                              and ClearedLineItem.FiscalYear         = OriginalJournalEntry.FiscalYear

{
  key GLAccountLineItem.SourceLedger,
  key GLAccountLineItem.CompanyCode,
  key GLAccountLineItem.FiscalYear,
  key GLAccountLineItem.AccountingDocument,
  key GLAccountLineItem.LedgerGLLineItem,
      cast( coalesce( InvoiceReference.DocumentDate, OriginalJournalEntry.DocumentDate ) as fipe_original_document_date preserving type) as DocumentDate,
      cast( coalesce( InvoiceReference.DocumentReferenceID, OriginalJournalEntry.DocumentReferenceID ) as fis_xblnr1 preserving type )   as DocumentReferenceID
}
where GLAccountLineItem.FinancialAccountType = 'K'