P_DeltaOpenItem

DDL: P_DELTAOPENITEM SQL: PGROITDII Type: view CONSUMPTION Package: ODATA_RESIDUAL_ITEMS

Delta Open Item

P_DeltaOpenItem is a Consumption CDS View that provides data about "Delta Open Item" in SAP S/4HANA. It reads from 2 data sources (I_AccountingDocument, I_OperationalAcctgDocItem) and exposes 39 fields with key fields CompanyCode, FiscalYear, AccountingDocument, AccountingDocumentItem. Part of development package ODATA_RESIDUAL_ITEMS.

Data Sources (2)

SourceAliasJoin Type
I_AccountingDocument InvoiceHeader inner
I_OperationalAcctgDocItem InvoiceItem from

Annotations (11)

NameValueLevelField
AbapCatalog.sqlViewName PGROITDII view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #MANDATORY view
ClientHandling.algorithm #SESSION_VARIABLE view
ObjectModel.representativeKey AccountingDocumentItem view
ObjectModel.usageType.sizeCategory #XXL view
ObjectModel.usageType.dataClass #MIXED view
ObjectModel.usageType.serviceQuality #D view
VDM.viewType #CONSUMPTION view
VDM.private true view

Fields (39)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_OperationalAcctgDocItem CompanyCode
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY AccountingDocumentItem I_OperationalAcctgDocItem AccountingDocumentItem
CreationDate I_AccountingDocument AccountingDocumentCreationDate
CreationTime I_AccountingDocument CreationTime
ClearingCreationDate ClearingHeader AccountingDocumentCreationDate
ClearingCreationTime ClearingHeader CreationTime
DebitCreditCode I_OperationalAcctgDocItem DebitCreditCode
CompanyCodeCurrency I_OperationalAcctgDocItem CompanyCodeCurrency
AmountInCompanyCodeCurrency I_OperationalAcctgDocItem AmountInCompanyCodeCurrency
TransactionCurrency I_OperationalAcctgDocItem TransactionCurrency
AmountInTransactionCurrency I_OperationalAcctgDocItem AmountInTransactionCurrency
Customer I_OperationalAcctgDocItem Customer
BillingDocument I_OperationalAcctgDocItem BillingDocument
AssignmentReference I_OperationalAcctgDocItem AssignmentReference
AccountingDocumentHeaderText I_AccountingDocument AccountingDocumentHeaderText
DocumentItemText I_OperationalAcctgDocItem DocumentItemText
PaymentDifferenceReason I_OperationalAcctgDocItem PaymentDifferenceReason
AccountingDocumentType I_AccountingDocument AccountingDocumentType
ClearingDate I_OperationalAcctgDocItem ClearingDate
ClearingDocFiscalYear I_OperationalAcctgDocItem ClearingDocFiscalYear
ClearingAccountingDocument I_OperationalAcctgDocItem ClearingAccountingDocument
ClearingItem
LastChangeDate I_AccountingDocument LastChangeDate
PostingDate I_OperationalAcctgDocItem PostingDate
DocumentDate I_OperationalAcctgDocItem DocumentDate
NetDueDate I_OperationalAcctgDocItem NetDueDate
CashDiscountBaseAmount I_OperationalAcctgDocItem CashDiscountBaseAmount
CashDiscountAmount I_OperationalAcctgDocItem CashDiscountAmount
PaymentTerms I_OperationalAcctgDocItem PaymentTerms
CashDiscount1Days I_OperationalAcctgDocItem CashDiscount1Days
CashDiscount2Days I_OperationalAcctgDocItem CashDiscount2Days
NetPaymentDays I_OperationalAcctgDocItem NetPaymentDays
CashDiscount1Percent I_OperationalAcctgDocItem CashDiscount1Percent
CashDiscount2Percent I_OperationalAcctgDocItem CashDiscount2Percent
DueCalculationBaseDate I_OperationalAcctgDocItem DueCalculationBaseDate
FixedCashDiscount I_OperationalAcctgDocItem FixedCashDiscount
PaymentBlockingReason I_OperationalAcctgDocItem PaymentBlockingReason
@AbapCatalog.sqlViewName: 'PGROITDII'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck:  #MANDATORY 
//@EndUserText.label: 'Delta Open Item'

@ClientHandling.algorithm: #SESSION_VARIABLE
@ObjectModel.representativeKey: 'AccountingDocumentItem'
@ObjectModel.usageType.sizeCategory: #XXL
@ObjectModel.usageType.dataClass:  #MIXED
@ObjectModel.usageType.serviceQuality: #D
@VDM.viewType: #CONSUMPTION
//@UI.presentationVariant.sortOrder.by: 'CreationDate, CreationTime'

//@UI.presentationVariant.sortOrder.direction: #ASC

@VDM.private: true
define view P_DeltaOpenItem
  as

  select from I_OperationalAcctgDocItem as InvoiceItem

    inner join I_AccountingDocument as InvoiceHeader on

        InvoiceItem.CompanyCode               = InvoiceHeader.CompanyCode and

        InvoiceItem.FiscalYear                = InvoiceHeader.FiscalYear and

        InvoiceItem.AccountingDocument        = InvoiceHeader.AccountingDocument

    left outer to one join I_AccountingDocument      as ClearingHeader on

        InvoiceItem.CompanyCode                = ClearingHeader.CompanyCode and

        InvoiceItem.ClearingDocFiscalYear      = ClearingHeader.FiscalYear and

        InvoiceItem.ClearingAccountingDocument = ClearingHeader.AccountingDocument
{
  key InvoiceItem.CompanyCode,
  key InvoiceItem.FiscalYear                                 as FiscalYear,
  key InvoiceItem.AccountingDocument                         as AccountingDocument,
  key InvoiceItem.AccountingDocumentItem                     as AccountingDocumentItem,
      InvoiceHeader.AccountingDocumentCreationDate           as CreationDate,
      InvoiceHeader.CreationTime                             as CreationTime,
      ClearingHeader.AccountingDocumentCreationDate          as ClearingCreationDate,
      ClearingHeader.CreationTime                            as ClearingCreationTime,
      InvoiceItem.DebitCreditCode,
      InvoiceItem.CompanyCodeCurrency,
      InvoiceItem.AmountInCompanyCodeCurrency,
      InvoiceItem.TransactionCurrency,
      InvoiceItem.AmountInTransactionCurrency,
      InvoiceItem.Customer,
      InvoiceItem.BillingDocument,
      InvoiceItem.AssignmentReference,
      InvoiceHeader.AccountingDocumentHeaderText, //                 as HeaderText,

      InvoiceItem.DocumentItemText,//                               as ItemtText,

      InvoiceItem.PaymentDifferenceReason,
      InvoiceHeader.AccountingDocumentType,
      InvoiceItem.ClearingDate,
      InvoiceItem.ClearingDocFiscalYear,
      InvoiceItem.ClearingAccountingDocument,
      cast( InvoiceItem.ClearingItem as agzei )           as ClearingItem,
      InvoiceHeader.LastChangeDate,
      InvoiceItem.PostingDate,
      InvoiceItem.DocumentDate,
      InvoiceItem.NetDueDate,
      InvoiceItem.CashDiscountBaseAmount,
      InvoiceItem.CashDiscountAmount,
      InvoiceItem.PaymentTerms,
      InvoiceItem.CashDiscount1Days,
      InvoiceItem.CashDiscount2Days,
      InvoiceItem.NetPaymentDays,
      InvoiceItem.CashDiscount1Percent,
      InvoiceItem.CashDiscount2Percent,
      InvoiceItem.DueCalculationBaseDate,
      InvoiceItem.FixedCashDiscount,
      InvoiceItem.PaymentBlockingReason,
      case when ( InvoiceItem.ClearingAccountingDocument is null or InvoiceItem.ClearingAccountingDocument = '' ) then
        concat(InvoiceHeader.AccountingDocumentCreationDate, InvoiceHeader.CreationTime)
      else
        concat(ClearingHeader.AccountingDocumentCreationDate, ClearingHeader.CreationTime)
      end                  as LastCreationOrClearingDatetime
}
where
    // We are not interested in residual items. They are already taken care by other extractors

    // We are currently also not interested in partial payment items, credit memo items and down payment items.

    (
      InvoiceItem.FollowOnDocumentType is null or
      InvoiceItem.FollowOnDocumentType = ''
    )
    and
      // Wer are only interested in A/R items

      InvoiceItem.FinancialAccountType = 'D'
    and
    // We are only interested in items of catagory '', 'S', or 'A'

    (
        InvoiceItem.AccountingDocumentCategory  = '' or
        InvoiceItem.AccountingDocumentCategory  = 'S' or
        InvoiceItem.AccountingDocumentCategory  = 'A'
    )