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.
@AccessControl.authorizationCheck: #NOT_REQUIRED@VDM.private: true@VDM.viewType: #CONSUMPTION@ObjectModel.usageType.sizeCategory: #XL@ObjectModel.usageType.serviceQuality: #D@ObjectModel.usageType.dataClass: #MIXEDdefineviewentity P_AR_SuplrPaymentPartialFull
asselectfrom I_StRpJournalEntryHeaderLog as StRpJournalEntryLog
innerjoin I_OperationalAcctgDocItem as Payment on Payment.CompanyCode = StRpJournalEntryLog.CompanyCode
and Payment.FiscalYear = StRpJournalEntryLog.FiscalYear
and Payment.AccountingDocument = StRpJournalEntryLog.AccountingDocument
innerjoin I_ClrgInfoRelationForAcctgDoc as ClearingInfo on ClearingInfo.ClearingInfoCompanyCode = StRpJournalEntryLog.CompanyCode
and ClearingInfo.ClearingFiscalYear = StRpJournalEntryLog.FiscalYear
and ClearingInfo.ClearingAccountingDocument = StRpJournalEntryLog.AccountingDocument
leftouter 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
leftouter 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 isnot initial
and PaymentVendorLine.ClearingJournalEntry isnot initial
leftouter to one join I_ClrgInfoRelationForAcctgDoc as ClearingInfoPaidItem on ClearingInfoPaidItem.ClearingInfoCompanyCode = ClearingInfo.CompanyCode
and ClearingInfoPaidItem.ClearingFiscalYear = ClearingInfo.FiscalYear
and ClearingInfoPaidItem.ClearingAccountingDocument = ClearingInfo.AccountingDocument
leftouter 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,
keycast( 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 isnullor 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 isnullor// discard relations with Partial Payments and down payments
(
ClearingInfoPaidItem.ClearingInformationType <> '2' // 2 = Partial payment without clearing
and PaidSpecialGLCode.SpecialGLTransactionType isnull
)
)
/*+[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":""
}
}*/