P_AR_SuplrPaymentPartialFull

DDL: P_AR_SUPLRPAYMENTPARTIALFULL Type: view_entity CONSUMPTION

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

Data Sources (3)

SourceAliasJoin Type
I_ClrgInfoRelationForAcctgDoc ClearingInfo inner
I_OperationalAcctgDocItem Payment inner
I_StRpJournalEntryHeaderLog StRpJournalEntryLog from

Annotations (6)

NameValueLevelField
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 (20)

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 ReltdDocAccountingDocument
KEY RelatedDocumentItemNumber I_ClrgInfoRelationForAcctgDoc AccountingDocumentItem
KEY ClearingInformationIndex I_ClrgInfoRelationForAcctgDoc ClearingInformationIndex
RelatedDocumentFiscalYear
ReltdSpclGLTransacType ClearingSpecialGLCode SpecialGLTransactionType
CompanyCodeCountry
PaymentDate
CompanyCodeCurrency I_OperationalAcctgDocItem CompanyCodeCurrency
PaytAmountInCoCodeCurrency
HouseBank I_OperationalAcctgDocItem HouseBank
PaymentGLAccount I_OperationalAcctgDocItem GLAccount
_GLAccountInCompanyCode I_OperationalAcctgDocItem _GLAccountInCompanyCode
PaymentMethod PaymentVendorLine PaymentMethod
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.private: true
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
define view entity P_AR_SuplrPaymentPartialFull
  as select from           I_StRpJournalEntryHeaderLog   as StRpJournalEntryLog

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

    inner join             I_ClrgInfoRelationForAcctgDoc as ClearingInfo          on  ClearingInfo.ClearingInfoCompanyCode    = StRpJournalEntryLog.CompanyCode
                                                                                  and ClearingInfo.ClearingFiscalYear         = StRpJournalEntryLog.FiscalYear
                                                                                  and ClearingInfo.ClearingAccountingDocument = StRpJournalEntryLog.AccountingDocument

    left outer to one join I_SpecialGLCode               as ClearingSpecialGLCode on  ClearingInfo.SpecialGLCode = ClearingSpecialGLCode.SpecialGLCode
                                                                                  and ClearingInfo.AccountType   = ClearingSpecialGLCode.FinancialAccountType

  // The payment method is only filled in the K vendor line

    left outer to one join I_OperationalAcctgDocItem     as PaymentVendorLine     on  PaymentVendorLine.CompanyCode          = Payment.CompanyCode
                                                                                  and PaymentVendorLine.FiscalYear           = Payment.FiscalYear
                                                                                  and PaymentVendorLine.AccountingDocument   = Payment.AccountingDocument
                                                                                  and PaymentVendorLine.FinancialAccountType = 'K'
                                                                                  and PaymentVendorLine.PaymentMethod        is not initial
                                                                                  and PaymentVendorLine.ClearingJournalEntry is not initial

    left outer to one join I_ClrgInfoRelationForAcctgDoc as ClearingInfoPaidItem  on  ClearingInfoPaidItem.ClearingInfoCompanyCode    = ClearingInfo.CompanyCode
                                                                                  and ClearingInfoPaidItem.ClearingFiscalYear         = ClearingInfo.FiscalYear
                                                                                  and ClearingInfoPaidItem.ClearingAccountingDocument = ClearingInfo.AccountingDocument

    left outer to one join I_SpecialGLCode               as PaidSpecialGLCode     on  ClearingInfoPaidItem.SpecialGLCode = PaidSpecialGLCode.SpecialGLCode
                                                                                  and ClearingInfoPaidItem.AccountType   = PaidSpecialGLCode.FinancialAccountType

{
  key StRpJournalEntryLog.StatryRptgEntity,
  key StRpJournalEntryLog.StatryRptCategory,
  key StRpJournalEntryLog.StatryRptRunID,
  key Payment.CompanyCode,
  key Payment.FiscalYear,
  key Payment.AccountingDocument,
  key Payment.AccountingDocumentItem,
  key cast( ClearingInfo.AccountingDocument as fis_belnr_rel_doc preserving type )        as ReltdDocAccountingDocument,
  key ClearingInfo.AccountingDocumentItem                                                 as RelatedDocumentItemNumber,
  key ClearingInfo.ClearingInformationIndex,

      cast( ClearingInfo.FiscalYear as fis_gjahr_rel_doc preserving type )                as RelatedDocumentFiscalYear,
      ClearingSpecialGLCode.SpecialGLTransactionType                                      as ReltdSpclGLTransacType,
      Payment._CompanyCode.Country                                                        as CompanyCodeCountry,
      cast( Payment.PostingDate as farp_payment_date preserving type )                    as PaymentDate,
      Payment.CompanyCodeCurrency,
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      cast( abs( Payment.AmountInCompanyCodeCurrency) as fiar_payment_amount_cocodecrcy ) as PaytAmountInCoCodeCurrency,
      Payment.HouseBank,
      Payment.GLAccount                                                                   as PaymentGLAccount,
      Payment._GLAccountInCompanyCode,
      PaymentVendorLine.PaymentMethod
}
where
          Payment.FinancialAccountType                   =  'S'
  and     Payment.ProfitLossAccountType                  =  '' // remove exchange rate difference line items

  and     Payment.WithholdingTaxCode                     =  ''

  and(
          ClearingSpecialGLCode.SpecialGLTransactionType is null
    or    ClearingSpecialGLCode.SpecialGLTransactionType =  'P' // P = payment request for automatic payment

  )

  and(
          // get the payments releated to invoice. Invoice does not have items in the I_ClrgInfoRelationForAcctgDoc

          ClearingInfoPaidItem.AccountingDocument        is null
    or
    // discard relations with Partial Payments and down payments

    (
          ClearingInfoPaidItem.ClearingInformationType   <> '2' // 2 =  Partial payment without clearing

      and PaidSpecialGLCode.SpecialGLTransactionType     is null
    )
  )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_CLRGINFORELATIONFORACCTGDOC",
"I_COMPANYCODE",
"I_OPERATIONALACCTGDOCITEM",
"I_SPECIALGLCODE",
"I_STRPJOURNALENTRYHEADERLOG"
],
"ASSOCIATED":
[
"I_GLACCOUNTINCOMPANYCODE"
],
"BASE":
[
"I_OPERATIONALACCTGDOCITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/