P_AR_EDplDocumentTotal

DDL: P_AR_EDPLDOCUMENTTOTAL SQL: PAREDUPHEATOT Type: view CONSUMPTION

P_AR_EDplDocumentTotal is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_AR_EDplDocAggregatedAmount, I_StRpJournalEntryHeaderLog) and exposes 18 fields with key fields CompanyCode, FiscalYear, StatryRptgEntity, StatryRptCategory, StatryRptRunID.

Data Sources (2)

SourceAliasJoin Type
P_AR_EDplDocAggregatedAmount P_AR_EDplDocAggregatedAmount from
I_StRpJournalEntryHeaderLog StRpJournalEntryLog inner

Parameters (3)

NameTypeDefault
P_RptgAmountIsInTransCrcy fiar_use_transaction_currency
P_FromReportingDate glo_reporting_date
P_ToReportingDate glo_reporting_date

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PAREDUPHEATOT view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
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
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (18)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode AggregatedAmount CompanyCode
KEY FiscalYear AggregatedAmount FiscalYear
KEY StatryRptgEntity I_StRpJournalEntryHeaderLog StatryRptgEntity
KEY StatryRptCategory I_StRpJournalEntryHeaderLog StatryRptCategory
KEY StatryRptRunID I_StRpJournalEntryHeaderLog StatryRptRunID
CompanyCodeCurrency AggregatedAmount CompanyCodeCurrency
NumberOfRecords
ReportingCurrency AggregatedAmount CompanyCodeCurrency
NotTaxedAmount
NotRegisteredBPTxAmtInRptgCrcy
TaxExemptionAmount
PerceptionVATAmount
GrossIncomeTaxAmount
MunicipalTaxAmount
OpenTotalTaxAmount
OtherTaxAmount
NetTaxAmount
TaxedAmountInRptgCrcy
@AbapCatalog.sqlViewName: 'PAREDUPHEATOT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@VDM.viewType: #CONSUMPTION
@VDM.private: true
@ClientHandling.algorithm: #SESSION_VARIABLE
define view P_AR_EDplDocumentTotal
  with parameters
    @Consumption.defaultValue:'X'
    P_RptgAmountIsInTransCrcy : fiar_use_transaction_currency,
    P_FromReportingDate       : glo_reporting_date,
    P_ToReportingDate         : glo_reporting_date

  as select from P_AR_EDplDocAggregatedAmount ( P_RptgAmountIsInTransCrcy: $parameters.P_RptgAmountIsInTransCrcy )
                                       as AggregatedAmount

  inner join   I_StRpJournalEntryHeaderLog             as StRpJournalEntryLog       on  StRpJournalEntryLog.CompanyCode        = AggregatedAmount.CompanyCode
                                                                                    and StRpJournalEntryLog.FiscalYear         = AggregatedAmount.FiscalYear
                                                                                    and StRpJournalEntryLog.AccountingDocument = AggregatedAmount.AccountingDocument

  left outer to one join P_AR_CustomerReceivableTotal  as CustomerReceivableTotal   on  CustomerReceivableTotal.CompanyCode        = AggregatedAmount.CompanyCode
                                                                                    and CustomerReceivableTotal.FiscalYear         = AggregatedAmount.FiscalYear
                                                                                    and CustomerReceivableTotal.AccountingDocument = AggregatedAmount.AccountingDocument

{
  key AggregatedAmount.CompanyCode,
  key AggregatedAmount.FiscalYear,
  key StRpJournalEntryLog.StatryRptgEntity,
  key StRpJournalEntryLog.StatryRptCategory,
  key StRpJournalEntryLog.StatryRptRunID,
      AggregatedAmount.CompanyCodeCurrency,
      cast( count( * ) as fiar_number_of_records preserving type )                                          as NumberOfRecords,

      @Semantics.currencyCode:true
      AggregatedAmount.CompanyCodeCurrency                                                                    as ReportingCurrency,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
        sum(
          case $parameters.P_RptgAmountIsInTransCrcy
            when 'X'
              then CustomerReceivableTotal.AmountInTransactionCurrency
            else CustomerReceivableTotal.AmountInCompanyCodeCurrency
          end
        ) as glo_amount_rptg_crcy preserving type
      )                                                                                                     as TotalGrossAmountInRptgCrcy,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
        sum(
          case $parameters.P_RptgAmountIsInTransCrcy
            when 'X'
              then CustomerReceivableTotal.AmountInTransactionCurrency
            else CustomerReceivableTotal.AmountInCompanyCodeCurrency
          end
        ) as glo_amount_rptg_crcy preserving type
      )                                                                                                     as AmountInReportingCurrency,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.NotTaxedAmount) as fi_ar_nottax_amnt preserving type )                       as NotTaxedAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.NotRegisteredBPTxAmtInRptgCrcy) as fiar_notreg_bptaxamount preserving type ) as NotRegisteredBPTxAmtInRptgCrcy,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.TaxExemptionAmount) as fiar_exempted_amount preserving type )                as TaxExemptionAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.PerceptionVATAmount) as fi_ar_perpvat_amnt preserving type )                 as PerceptionVATAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.GrossIncomeTaxAmount) as fiar_provincial_tax_amount preserving type )        as GrossIncomeTaxAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.MunicipalTaxAmount) as fi_ar_mptax_amnt preserving type )                    as MunicipalTaxAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.OpenTotalTaxAmount) as fiar_internal_tax_amount preserving type )            as OpenTotalTaxAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.OtherTaxAmount) as fiar_other_tax_amount preserving type )                   as OtherTaxAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.NetTaxAmount) as fiar_net_tax_amount preserving type )                       as NetTaxAmount,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast( sum(AggregatedAmount.TaxedAmountInRptgCrcy) as fiar_taxed_base_amount preserving type )           as TaxedAmountInRptgCrcy
}
where
  AggregatedAmount.ReportingDate between $parameters.P_FromReportingDate and $parameters.P_ToReportingDate
group by
  AggregatedAmount.CompanyCode,
  AggregatedAmount.FiscalYear,
  AggregatedAmount.CompanyCodeCurrency,
  StRpJournalEntryLog.StatryRptgEntity,
  StRpJournalEntryLog.StatryRptCategory,
  StRpJournalEntryLog.StatryRptRunID
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"I_STRPJOURNALENTRYHEADERLOG",
"P_AR_CUSTOMERRECEIVABLETOTAL",
"P_AR_EDPLDOCAGGREGATEDAMOUNT"
],
"ASSOCIATED":
[],
"BASE":
[],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/