P_APJrnlEntrItmOpenPay1

DDL: P_APJRNLENTRITMOPENPAY1 SQL: PAPJEITMOPNPAY1 Type: view COMPOSITE

P_APJrnlEntrItmOpenPay1 is a Composite CDS View in SAP S/4HANA. It reads from 2 data sources (I_JournalEntryOperationalView, I_ReceivablesPayablesItem) and exposes 34 fields with key fields CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem.

Data Sources (2)

SourceAliasJoin Type
I_JournalEntryOperationalView OpenPayables from
I_ReceivablesPayablesItem ReferencedInvoices left_outer

Parameters (1)

NameTypeDefault
P_KeyDate sydate

Annotations (5)

NameValueLevelField
AbapCatalog.sqlViewName PAPJEITMOPNPAY1 view
VDM.viewType #COMPOSITE view
VDM.private true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (34)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_JournalEntryOperationalView CompanyCode
KEY FiscalYear I_JournalEntryOperationalView FiscalYear
KEY AccountingDocument I_JournalEntryOperationalView AccountingDocument
KEY LedgerGLLineItem I_JournalEntryOperationalView LedgerGLLineItem
AccountingDocumentCategory I_JournalEntryOperationalView AccountingDocumentCategory
AccountingDocumentType I_JournalEntryOperationalView AccountingDocumentType
AccountingDocumentItem I_JournalEntryOperationalView AccountingDocumentItem
InvoiceReference I_JournalEntryOperationalView InvoiceReference
InvoiceItemReference I_JournalEntryOperationalView InvoiceItemReference
InvoiceReferenceFiscalYear I_JournalEntryOperationalView InvoiceReferenceFiscalYear
ClearingDate I_JournalEntryOperationalView ClearingDate
PostingDate I_JournalEntryOperationalView PostingDate
DocumentDate I_JournalEntryOperationalView DocumentDate
FinancialAccountType I_JournalEntryOperationalView FinancialAccountType
Supplier I_JournalEntryOperationalView Supplier
FollowOnDocumentType I_JournalEntryOperationalView FollowOnDocumentType
NetDueDate I_JournalEntryOperationalView NetDueDate
SpecialGLCode I_JournalEntryOperationalView SpecialGLCode
GLAccount I_JournalEntryOperationalView GLAccount
CostCenter I_JournalEntryOperationalView CostCenter
ProfitCenter I_JournalEntryOperationalView ProfitCenter
FunctionalArea I_JournalEntryOperationalView FunctionalArea
BusinessArea I_JournalEntryOperationalView BusinessArea
Segment I_JournalEntryOperationalView Segment
PurchasingDocument I_JournalEntryOperationalView PurchasingDocument
AssignmentReference I_JournalEntryOperationalView AssignmentReference
CompanyCodeCurrency I_JournalEntryOperationalView CompanyCodeCurrency
AmountInCompanyCodeCurrency I_JournalEntryOperationalView AmountInCompanyCodeCurrency
RefInvcDocumentDate I_ReceivablesPayablesItem DocumentDate
RefInvcFinancialAccountType I_ReceivablesPayablesItem FinancialAccountType
RefInvcDebitCreditCode I_ReceivablesPayablesItem DebitCreditCode
RefInvcNetPaymentDays I_ReceivablesPayablesItem NetPaymentDays
RefInvcInvoiceReference I_ReceivablesPayablesItem InvoiceReference
RefInvcNetDueDate I_ReceivablesPayablesItem NetDueDate
@AbapCatalog.sqlViewName: 'PAPJEITMOPNPAY1'
@VDM.viewType: #COMPOSITE
@VDM.private:true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_APJrnlEntrItmOpenPay1
  with parameters
    P_KeyDate : sydate

// get the referenced invoices to e.g. partial payments; net due date of partial payment will then be adjusted to net due date of referenced invoice so

//  in Analytics both items are assigned to the correct aging period and correctly summed up in this aging period for due date of invoice

  as select from    I_JournalEntryOperationalView as OpenPayables
    left outer join I_ReceivablesPayablesItem as ReferencedInvoices 
                                                            on  OpenPayables.CompanyCode                = ReferencedInvoices.CompanyCode
                                                            and OpenPayables.InvoiceReference           = ReferencedInvoices.AccountingDocument
                                                            and OpenPayables.InvoiceItemReference       = ReferencedInvoices.AccountingDocumentItem
                                                            and OpenPayables.InvoiceReferenceFiscalYear = ReferencedInvoices.FiscalYear
                                                            and OpenPayables.FinancialAccountType       = ReferencedInvoices.FinancialAccountType
                                                            and OpenPayables.AccountingDocumentCategory = ReferencedInvoices.AccountingDocumentCategory

{
  key OpenPayables.CompanyCode                                    as CompanyCode,
  key OpenPayables.FiscalYear                                     as FiscalYear,
  key OpenPayables.AccountingDocument                             as AccountingDocument,
  key OpenPayables.LedgerGLLineItem                               as LedgerGLLineItem,

      OpenPayables.AccountingDocumentCategory,
      OpenPayables.AccountingDocumentType,

      OpenPayables.AccountingDocumentItem                         as AccountingDocumentItem,
      OpenPayables.InvoiceReference                               as InvoiceReference,
      OpenPayables.InvoiceItemReference                           as InvoiceItemReference,
      OpenPayables.InvoiceReferenceFiscalYear                     as InvoiceReferenceFiscalYear,
      OpenPayables.ClearingDate                                   as ClearingDate,
      OpenPayables.PostingDate                                    as PostingDate,
      OpenPayables.DocumentDate                                   as DocumentDate,
      OpenPayables.FinancialAccountType                           as FinancialAccountType,
      OpenPayables.Supplier                                       as Supplier,
      OpenPayables.FollowOnDocumentType                           as FollowOnDocumentType,
      OpenPayables.NetDueDate                                     as NetDueDate,
      OpenPayables.SpecialGLCode                                  as SpecialGLCode,
      OpenPayables.GLAccount                                      as GLAccount,
      OpenPayables.CostCenter                                     as CostCenter,
      OpenPayables.ProfitCenter                                   as ProfitCenter,
      OpenPayables.FunctionalArea                                 as FunctionalArea,
      OpenPayables.BusinessArea                                   as BusinessArea,
      OpenPayables.Segment                                        as Segment,
      OpenPayables.PurchasingDocument                             as PurchasingDocument,
      OpenPayables.AssignmentReference                            as AssignmentReference,
      OpenPayables.CompanyCodeCurrency                            as CompanyCodeCurrency,
      OpenPayables.AmountInCompanyCodeCurrency                    as AmountInCompanyCodeCurrency,

      ReferencedInvoices.DocumentDate                                as RefInvcDocumentDate,
      ReferencedInvoices.FinancialAccountType                        as RefInvcFinancialAccountType,
      ReferencedInvoices.DebitCreditCode                             as RefInvcDebitCreditCode,
      ReferencedInvoices.NetPaymentDays                              as RefInvcNetPaymentDays,
      ReferencedInvoices.InvoiceReference                            as RefInvcInvoiceReference,
      ReferencedInvoices.NetDueDate                                  as RefInvcNetDueDate
}
where  OpenPayables.SourceLedger                = '0L'
  and  OpenPayables.Ledger                      = '0L'
  and  OpenPayables.FinancialAccountType        = 'K'
  and  OpenPayables.AccountingDocumentCategory  =  ''
  and  OpenPayables.AccountingDocumentItem      <> '000'
  and  OpenPayables.NetDueDate                  <> '00000000'
  and  OpenPayables.NetDueDate                  is not null  // be sure to get only operational items with BSEG item

  and(
       OpenPayables.ClearingDate                >  :P_KeyDate
    or OpenPayables.ClearingDate                =  '00000000'
  )
  and  OpenPayables.PostingDate                 <= :P_KeyDate              
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_JOURNALENTRYOPERATIONALVIEW",
"I_RECEIVABLESPAYABLESITEM"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/