P_AR_SuplrPaymentEndorsedCheck

DDL: P_AR_SUPLRPAYMENTENDORSEDCHECK Type: view_entity CONSUMPTION

P_AR_SuplrPaymentEndorsedCheck is a Consumption CDS View in SAP S/4HANA. It reads from 4 data sources (I_BillOfExchange, I_OperationalAcctgDocItem, I_OperationalAcctgDocItem, I_StRpJournalEntryHeaderLog) and exposes 21 fields with key fields StatryRptgEntity, StatryRptCategory, StatryRptRunID, CompanyCode, FiscalYear.

Data Sources (4)

SourceAliasJoin Type
I_BillOfExchange BillOfExchange inner
I_OperationalAcctgDocItem ClearingInformation inner
I_OperationalAcctgDocItem CustomerCheck inner
I_StRpJournalEntryHeaderLog StRpJournalEntryLog from

Annotations (6)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.serviceQuality #D view
ObjectModel.usageType.dataClass #MIXED view
VDM.viewType #CONSUMPTION view
VDM.private true view

Fields (21)

KeyFieldSource TableSource FieldDescription
KEY StatryRptgEntity I_StRpJournalEntryHeaderLog StatryRptgEntity
KEY StatryRptCategory I_StRpJournalEntryHeaderLog StatryRptCategory
KEY StatryRptRunID I_StRpJournalEntryHeaderLog StatryRptRunID
KEY CompanyCode I_OperationalAcctgDocItem CompanyCode
KEY FiscalYear I_OperationalAcctgDocItem FiscalYear
KEY AccountingDocument I_OperationalAcctgDocItem AccountingDocument
KEY AccountingDocumentItem I_OperationalAcctgDocItem AccountingDocumentItem
KEY ClearingInformationIndex
Supplier I_OperationalAcctgDocItem Supplier
PaymentDate
CompanyCodeCountry
CompanyCodeCurrency I_OperationalAcctgDocItem CompanyCodeCurrency
PaytAmountInCoCodeCurrency
ReltdSpclGLTransacType I_OperationalAcctgDocItem SpecialGLTransactionType
HouseBank I_OperationalAcctgDocItem HouseBank
PaymentGLAccount I_OperationalAcctgDocItem GLAccount
_GLAccountInCompanyCode I_OperationalAcctgDocItem _GLAccountInCompanyCode
PaymentMethod I_OperationalAcctgDocItem PaymentMethod
CheckIssuerTaxNumber
EndorsedBankTaxNumber I_BillOfExchange BillOfExchangeDomicileText
EndorsedCheckNumber I_OperationalAcctgDocItem AssignmentReference
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@VDM.viewType: #CONSUMPTION
@VDM.private: true
define view entity P_AR_SuplrPaymentEndorsedCheck
  as select from           I_StRpJournalEntryHeaderLog as StRpJournalEntryLog

    inner join             I_OperationalAcctgDocItem   as ClearingInformation     on  ClearingInformation.CompanyCode        = StRpJournalEntryLog.CompanyCode
                                                                                  and ClearingInformation.FiscalYear         = StRpJournalEntryLog.FiscalYear
                                                                                  and ClearingInformation.AccountingDocument = StRpJournalEntryLog.AccountingDocument

    inner join             I_OperationalAcctgDocItem   as CustomerCheck           on  CustomerCheck.CompanyCode                    =  ClearingInformation.CompanyCode
                                                                                  and CustomerCheck.ClearingJournalEntry           =  ClearingInformation.AccountingDocument
                                                                                  and CustomerCheck.ClearingJournalEntryFiscalYear =  ClearingInformation.FiscalYear
                                                                                  and CustomerCheck.FinancialAccountType           =  'D'
                                                                                  and CustomerCheck.SpecialGLTransactionType       =  'W'
                                                                                  and CustomerCheck.AccountingDocument             <> ClearingInformation.AccountingDocument

    inner join             I_BillOfExchange            as BillOfExchange          on  CustomerCheck.AccountingDocument = BillOfExchange.AccountingDocument
                                                                                  and CustomerCheck.FiscalYear         = BillOfExchange.FiscalYear
                                                                                  and CustomerCheck.CompanyCode        = BillOfExchange.CompanyCode

    left outer to one join I_OperationalAcctgDocItem   as InvoicePartiallyCleared on  InvoicePartiallyCleared.CompanyCode            = ClearingInformation.CompanyCode
                                                                                  and InvoicePartiallyCleared.AccountingDocument     = ClearingInformation.InvoiceReference
                                                                                  and InvoicePartiallyCleared.FiscalYear             = ClearingInformation.InvoiceReferenceFiscalYear
                                                                                  and InvoicePartiallyCleared.AccountingDocumentItem = ClearingInformation.InvoiceItemReference

    left outer to one join I_OperationalAcctgDocItem   as InvoiceFullyCleared     on  InvoiceFullyCleared.CompanyCode                    =  ClearingInformation.CompanyCode
                                                                                  and InvoiceFullyCleared.ClearingJournalEntry           =  ClearingInformation.AccountingDocument
                                                                                  and InvoiceFullyCleared.ClearingJournalEntryFiscalYear =  ClearingInformation.FiscalYear
                                                                                  and InvoiceFullyCleared.AccountingDocument             <> InvoiceFullyCleared.ClearingJournalEntry
                                                                                  and InvoiceFullyCleared.FinancialAccountType           =  'K'
                                                                                  and InvoiceFullyCleared.InvoiceReference               is initial // discard clearing doc


{
  key StRpJournalEntryLog.StatryRptgEntity,
  key StRpJournalEntryLog.StatryRptCategory,
  key StRpJournalEntryLog.StatryRptRunID,
  key ClearingInformation.CompanyCode,
  key ClearingInformation.FiscalYear,
  key ClearingInformation.AccountingDocument,
  key ClearingInformation.AccountingDocumentItem,
      // Fixed value because we dont use bse_clr in this cds. But its needed for the union

  key '000001'                                                                                          as ClearingInformationIndex,

      cast(
        case
          when InvoicePartiallyCleared.AccountingDocument is not null
            then InvoicePartiallyCleared.AccountingDocument
          when InvoiceFullyCleared.AccountingDocument is not null
            then InvoiceFullyCleared.AccountingDocument
      end as fis_belnr_rel_doc preserving type )                                                        as ReltdDocAccountingDocument,

      cast(
        case
          when InvoicePartiallyCleared.AccountingDocumentItem is not null
            then InvoicePartiallyCleared.AccountingDocumentItem
          when InvoiceFullyCleared.AccountingDocumentItem is not null
            then InvoiceFullyCleared.AccountingDocumentItem
      end as fis_buzei preserving type )                                                                as RelatedDocumentItemNumber,

      cast(
        case
          when InvoicePartiallyCleared.FiscalYear is not null
            then InvoicePartiallyCleared.FiscalYear
          when InvoiceFullyCleared.FiscalYear is not null
            then InvoiceFullyCleared.FiscalYear
      end as fis_gjahr_rel_doc preserving type )                                                        as RelatedDocumentFiscalYear,

      cast(
        case
          when InvoicePartiallyCleared.TransactionCurrency is not null
            then InvoicePartiallyCleared.TransactionCurrency
          when InvoiceFullyCleared.TransactionCurrency is not null
            then InvoiceFullyCleared.TransactionCurrency
      end as fiar_reltd_document_trans_crcy preserving type )                                           as ReltdDocTransactionCurrency,

      @Semantics.amount.currencyCode: 'ReltdDocTransactionCurrency'
      cast(
        case
          when InvoicePartiallyCleared.AmountInTransactionCurrency is not null
            then abs(InvoicePartiallyCleared.AmountInTransactionCurrency)
          when InvoiceFullyCleared.AmountInTransactionCurrency is not null
            then abs(InvoiceFullyCleared.AmountInTransactionCurrency)
      end as fiar_reltd_doc_amnt_trans_crcy preserving type )                                           as ReltdDocAmtInTransCurrency,

      ClearingInformation.Supplier,
      cast ( ClearingInformation.PostingDate as farp_payment_date )                                     as PaymentDate,
      ClearingInformation._CompanyCode.Country                                                          as CompanyCodeCountry,
      ClearingInformation.CompanyCodeCurrency,
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      cast ( abs( ClearingInformation.AmountInCompanyCodeCurrency ) as fiar_payment_amount_cocodecrcy ) as PaytAmountInCoCodeCurrency,
      CustomerCheck.SpecialGLTransactionType                                                            as ReltdSpclGLTransacType,
      ClearingInformation.HouseBank,
      ClearingInformation.GLAccount                                                                     as PaymentGLAccount,
      ClearingInformation._GLAccountInCompanyCode,
      ClearingInformation.PaymentMethod                                                                 as PaymentMethod,
      cast ( BillOfExchange.BillOfExchangeDraweeCityName as fiar_check_issuer_tax_number )              as CheckIssuerTaxNumber,
      BillOfExchange.BillOfExchangeDomicileText                                                         as EndorsedBankTaxNumber,
      CustomerCheck.AssignmentReference                                                                 as EndorsedCheckNumber

}
where
  ClearingInformation.FinancialAccountType = 'K'