P_MLColl_AcctgDocItemOpen

DDL: P_MLCOLL_ACCTGDOCITEMOPEN Type: view COMPOSITE Package: UDM_COLL_ML

ML Collections Accounting Doc Items Open

P_MLColl_AcctgDocItemOpen is a Composite CDS View that provides data about "ML Collections Accounting Doc Items Open" in SAP S/4HANA. It reads from 2 data sources (I_OperationalAcctgDocItem, P_MLColl_DirectPayers5) and exposes 19 fields with key fields AccountingDocument, FiscalYear, AccountingDocumentItem. It has 1 association to related views. Part of development package UDM_COLL_ML.

Data Sources (2)

SourceAliasJoin Type
I_OperationalAcctgDocItem _AccDoc from
P_MLColl_DirectPayers5 _DirectPayers inner

Parameters (3)

NameTypeDefault
P_ExchangeRateType kurst
P_TargetCurrency vdm_v_target_currency
P_SystemDate sydate

Associations (1)

CardinalityTargetAliasCondition
[0..1] I_BusinessPartnerCustomer _CustomerToBusinessPartner $projection.Customer = _CustomerToBusinessPartner.Customer

Annotations (7)

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

Fields (19)

KeyFieldSource TableSource FieldDescription
CompanyCode
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
KEY AccountingDocumentItem I_OperationalAcctgDocItem AccountingDocumentItem
Customer I_OperationalAcctgDocItem Customer
BusinessPartner _CustomerToBusinessPartner BusinessPartner
ClearingDate I_OperationalAcctgDocItem ClearingDate
DueCalculationBaseDate I_OperationalAcctgDocItem DueCalculationBaseDate
LastDunningDate I_OperationalAcctgDocItem LastDunningDate
DunningLevel I_OperationalAcctgDocItem DunningLevel
NetDueDate I_OperationalAcctgDocItem NetDueDate
AmountInTransactionCurrency I_OperationalAcctgDocItem AmountInTransactionCurrency
TransactionCurrency I_OperationalAcctgDocItem TransactionCurrency
PaymentTerms I_OperationalAcctgDocItem PaymentTerms
P_SystemDatethen1else0endasIsOverdue
P_SystemDateasOverdueDays
TargetCurrency
trueasAmountInTargetCurrency
_Customer I_OperationalAcctgDocItem _Customer
@AbapCatalog: { sqlViewName: 'PMLACCTGDOCIOPEN',
                compiler: { compareFilter: true },
                preserveKey: true }
@ClientHandling: { algorithm: #SESSION_VARIABLE }
@AccessControl: { authorizationCheck: #NOT_REQUIRED }
@VDM: { private:  true,
        viewType: #COMPOSITE }

define view P_MLColl_AcctgDocItemOpen
  with parameters
    P_ExchangeRateType : kurst,
    P_TargetCurrency   : vdm_v_target_currency,
    @Environment: { systemField : #SYSTEM_DATE }
    P_SystemDate       : sydate
  as select from I_OperationalAcctgDocItem as _AccDoc
    inner join   P_MLColl_DirectPayers5    as _DirectPayers on  _AccDoc.CompanyCode = _DirectPayers.CompanyCode
                                                            and _AccDoc.Customer    = _DirectPayers.Customer
                                                            
  // VDM associations 

  // Customer to Business Partner

  association [0..1] to I_BusinessPartnerCustomer as _CustomerToBusinessPartner on $projection.Customer = _CustomerToBusinessPartner.Customer
  
{

      // VDM fields

  key _AccDoc.CompanyCode,
  key _AccDoc.AccountingDocument,
  key _AccDoc.FiscalYear,
  key _AccDoc.AccountingDocumentItem,
      _AccDoc.Customer,
      _CustomerToBusinessPartner.BusinessPartner,
      _AccDoc.ClearingDate,
      _AccDoc.DueCalculationBaseDate,
      _AccDoc.LastDunningDate,
      _AccDoc.DunningLevel,

      case when _AccDoc.DunningLevel > '0'
            then 1
           else 0 end                              as NumberOfDunnedAcctgDocItems,

      _AccDoc.NetDueDate,
      _AccDoc.AmountInTransactionCurrency,
      _AccDoc.TransactionCurrency,
      _AccDoc.PaymentTerms,

      case when _AccDoc.NetDueDate < $parameters.P_SystemDate
            then 1
           else 0
      end                                          as IsOverdue,

      dats_days_between( _AccDoc.NetDueDate,
                         $parameters.P_SystemDate) as OverdueDays,
      :P_TargetCurrency                            as TargetCurrency,

      @Semantics: { amount: { currencyCode: 'TargetCurrency' } }
      currency_conversion(
          amount             => _AccDoc.AmountInTransactionCurrency,
          source_currency    => _AccDoc.TransactionCurrency,
          target_currency    => :P_TargetCurrency,
          exchange_rate_date => _AccDoc.DueCalculationBaseDate,
          exchange_rate_type => :P_ExchangeRateType,
          error_handling     => 'SET_TO_NULL',
          decimal_shift      => #CDSBoolean.true,
          round              => #CDSBoolean.true ) as AmountInTargetCurrency,

      // VDM associations

      _AccDoc._Customer
}
where
      _AccDoc.DebitCreditCode            =  'S'
  and _AccDoc.NetDueDate                 <> '00000000'
  and _AccDoc.DueCalculationBaseDate     <> '00000000'
  and _AccDoc.DocumentDate               <= _AccDoc.DueCalculationBaseDate
  and _AccDoc.InvoiceReference           =  ''
  and _AccDoc.ClearingDate               =  '00000000'
  and _AccDoc.FinancialAccountType       =  'D'
  and _AccDoc.AccountingDocumentCategory is initial