C_PT_SAFTPaymentLineC

DDL: C_PT_SAFTPAYMENTLINEC Type: view_entity CONSUMPTION

Payment Lines for SAFT PT - Cube

C_PT_SAFTPaymentLineC is a Consumption CDS View (Cube) that provides data about "Payment Lines for SAFT PT - Cube" in SAP S/4HANA. It reads from 3 data sources (I_ClrgInfoRelationForAcctgDoc, I_JournalEntry, P_PT_SAFTPAYORGON) and exposes 17 fields with key fields CompanyCode, ClearingAccountingDocument, ClearingFiscalYear, DocumentItemNumber.

Data Sources (3)

SourceAliasJoin Type
I_ClrgInfoRelationForAcctgDoc Clear inner
I_JournalEntry Document from
P_PT_SAFTPAYORGON Orig inner

Annotations (10)

NameValueLevelField
AccessControl.authorizationCheck #MANDATORY view
VDM.viewType #CONSUMPTION view
Analytics.internalName #LOCAL view
Metadata.allowExtensions true view
Analytics.dataCategory #CUBE view
EndUserText.label Payment Lines for SAFT PT - Cube view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #MIXED view

Fields (17)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_JournalEntry CompanyCode
KEY ClearingAccountingDocument I_JournalEntry AccountingDocument
KEY ClearingFiscalYear I_JournalEntry FiscalYear
KEY DocumentItemNumber I_ClrgInfoRelationForAcctgDoc ClearingInformationIndex
AccountingDocument I_ClrgInfoRelationForAcctgDoc AccountingDocument
FiscalYear I_ClrgInfoRelationForAcctgDoc FiscalYear
PostingDate I_JournalEntry PostingDate
ClearingInfoCompanyCode P_PT_SAFTPAYORGON ClearingInfoCompanyCode
OriginalReferenceDocument P_PT_SAFTPAYORGON OriginalReferenceDocument
CompanyCurrency I_ClrgInfoRelationForAcctgDoc CompanyCodeCurrency
TransactionCurrency I_ClrgInfoRelationForAcctgDoc TransactionCurrency
ExchangeRate I_JournalEntry AbsoluteExchangeRate
PaymentMethod
_CompanyCode I_JournalEntry _CompanyCode
_BillDgtlSgntr P_PT_SAFTPAYORGON _BillDgtlSgntr
AccountingDocumentType
DocumentDate
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #MANDATORY
@VDM.viewType: #CONSUMPTION
@Analytics.internalName:#LOCAL
@Metadata.allowExtensions:true
@Analytics: { dataCategory: #CUBE }
@EndUserText.label: 'Payment Lines for SAFT PT - Cube'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #X,
  sizeCategory: #S,
  dataClass: #MIXED
}
define view entity C_PT_SAFTPaymentLineC
  as select from           I_JournalEntry                as Document

    inner join             I_ClrgInfoRelationForAcctgDoc as Clear             on  Clear.ClearingInfoCompanyCode    =  Document.CompanyCode
                                                                              and Clear.ClearingAccountingDocument =  Document.AccountingDocument
                                                                              and Clear.ClearingFiscalYear         =  Document.FiscalYear
                                                                              and Clear.AccountType                =  'D' //only customers accounts

                                                                              and Clear.SpecialGLCode              <> 'F'

    inner join             P_PT_SAFTPAYORGON             as Orig              on  Orig.ClearingInfoCompanyCode    = Document.CompanyCode
                                                                              and Orig.ClearingAccountingDocument = Document.AccountingDocument
                                                                              and Orig.FiscalYear                 = Document.FiscalYear
                                                                              and Orig.DocumentItemNumber         = Clear.ClearingInformationIndex

    left outer to one join I_PT_SAFTDownPaymentFinance   as ClearingToExclude on  ClearingToExclude.CompanyCode    =  Document.CompanyCode
                                                                              and ClearingToExclude.FromFiscalYear <= Document.FiscalYear
                                                                              and ClearingToExclude.ToFiscalYear   >= Document.FiscalYear
                                                                              and ClearingToExclude.DocumentType   =  Document.AccountingDocumentType
{
  key Document.CompanyCode,
  key Document.AccountingDocument                                                 as ClearingAccountingDocument,
  key Document.FiscalYear                                                         as ClearingFiscalYear,
  key Clear.ClearingInformationIndex                                              as DocumentItemNumber,

      Clear.AccountingDocument,
      Clear.FiscalYear                                                            as FiscalYear,
      Document.PostingDate,
      Orig.ClearingInfoCompanyCode,
      Orig.OriginalReferenceDocument,
      Clear.CompanyCodeCurrency                                                   as CompanyCurrency,
      Clear.TransactionCurrency,
      @Semantics.amount.currencyCode: 'CompanyCurrency'
      case
        when Clear.DebitCreditCode = 'H'
        then
          case
            when Clear.DifferenceAmtInCoCodeCrcy is initial
            then abs(Clear.AmountInCompanyCodeCurrency - Clear.CashDiscountAmtInCoCodeCrcy )
            else abs(Clear.AmountInCompanyCodeCurrency - Clear.DifferenceAmtInCoCodeCrcy - Clear.CashDiscountAmtInCoCodeCrcy )
          end
      else cast(0 as fis_dr_hsl)
      end                                                                         as DebitAmountInCoCodeCrcy,

      @Semantics.amount.currencyCode: 'CompanyCurrency'
      case
        when Clear.DebitCreditCode = 'S'
        then
          case
            when Clear.DifferenceAmtInCoCodeCrcy is initial
            then abs(Clear.AmountInCompanyCodeCurrency - Clear.CashDiscountAmtInCoCodeCrcy )
            else abs(Clear.AmountInCompanyCodeCurrency - Clear.DifferenceAmtInCoCodeCrcy - Clear.CashDiscountAmtInCoCodeCrcy )
          end
      else cast(0 as fis_dr_hsl)
      end                                                                         as CreditAmountInCoCodeCrcy,

      Document.AbsoluteExchangeRate                                               as ExchangeRate,

      //Amount Foreign Currency

      @Semantics.amount.currencyCode: 'TransactionCurrency'
      case
        when Clear.DebitCreditCode = 'H'
        then
          case
            when Clear.DifferenceAmtInTransCrcy is initial
            then abs(Clear.AmountInTransactionCurrency - Clear.CashDiscountAmount )
            else abs(Clear.AmountInTransactionCurrency + Clear.DifferenceAmtInTransCrcy - Clear.CashDiscountAmount )
          end
      else cast(0 as fis_dr_hsl)
      end                                                                         as DebitAmountInTransCrcy,

      @Semantics.amount.currencyCode: 'TransactionCurrency'
      case
        when Clear.DebitCreditCode = 'S'
        then
          case
            when Clear.DifferenceAmtInTransCrcy is initial
            then abs(Clear.AmountInTransactionCurrency - Clear.CashDiscountAmount )
            else abs(Clear.AmountInTransactionCurrency - Clear.DifferenceAmtInTransCrcy - Clear.CashDiscountAmount )
          end
      else cast(0 as fis_dr_hsl)
      end                                                                         as CreditAmountInTransCrcy,

      @Semantics.amount.currencyCode: 'CompanyCurrency'
      case
        when Clear._AccountingDocument._OperationalAcctgDocItem[FinancialAccountType = 'D'   //Partial Payment, Invoice not cleared

                                                        and ClearingJournalEntry is initial ].AccountingDocument is not initial
          or Clear.DifferenceAmtInTransCrcy is initial   //or Partial Payment, Invoice clearing line

        then Clear.CashDiscountAmtInCoCodeCrcy
      else cast(0 as fis_dr_hsl)
      end                                                                         as CashDiscountAmtInCoCodeCrcy,

      Document._OperationalAcctgDocItem[FinancialAccountType = 'D'].PaymentMethod as PaymentMethod,

      @Semantics.booleanIndicator:true
      case
        when ClearingToExclude.DownPaymentType = '2'
        then 'X'
        else 'I'
      end                                                                         as SelectedValueIsExcluded,

      Document._CompanyCode,
      Orig._BillDgtlSgntr,
      Clear._AccountingDocument.AccountingDocumentType,
      Clear._AccountingDocument.DocumentDate
}
where
  Document.IsReversal = ' '
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_ACCOUNTINGDOCUMENT",
"I_CLRGINFORELATIONFORACCTGDOC",
"I_JOURNALENTRY",
"I_OPERATIONALACCTGDOCITEM",
"I_PT_SAFTDOWNPAYMENTFINANCE",
"P_PT_SAFTPAYORGON"
],
"ASSOCIATED":
[
"I_COMPANYCODE",
"I_PT_BILLGDOCDGTLSGNTR"
],
"BASE":
[
"I_JOURNALENTRY",
"P_PT_SAFTPAYORGON"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/