P_AR_PurchaseVATRateDetail

DDL: P_AR_PURCHASEVATRATEDETAIL SQL: PARPURCVATRD Type: view CONSUMPTION

P_AR_PurchaseVATRateDetail is a Consumption CDS View in SAP S/4HANA. It reads from 2 data sources (P_AR_JournalEntry, P_AR_PurVATRateAggregatedAmt2) and exposes 22 fields with key fields CompanyCode, FiscalYear, AccountingDocument, TaxRate.

Data Sources (2)

SourceAliasJoin Type
P_AR_JournalEntry JournalEntry inner
P_AR_PurVATRateAggregatedAmt2 PurVATRateAggregatedAmt from

Parameters (1)

NameTypeDefault
P_RptgAmountIsInTransCrcy fiar_use_transaction_currency

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PARPURCVATRD 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 (22)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode P_AR_JournalEntry CompanyCode
KEY FiscalYear P_AR_JournalEntry FiscalYear
KEY AccountingDocument P_AR_JournalEntry AccountingDocument
KEY TaxRate P_AR_PurVATRateAggregatedAmt2 TaxRate
PostingDate P_AR_JournalEntry PostingDate
DocumentDate P_AR_JournalEntry DocumentDate
ReportingDate P_AR_PurVATRateAggregatedAmt2 ReportingDate
TaxReportingDate P_AR_JournalEntry TaxReportingDate
AccountingDocumentType P_AR_JournalEntry AccountingDocumentType
DocumentReferenceID P_AR_JournalEntry DocumentReferenceID
AR_PrintCharacter P_AR_JournalEntry AR_PrintCharacter
AR_Branch P_AR_JournalEntry AR_Branch
AR_OfficialDocumentNumber P_AR_JournalEntry AR_OfficialDocumentNumber
CompanyCodeCountry P_AR_PurVATRateAggregatedAmt2 CompanyCodeCountry
CompanyCodeCurrency P_AR_JournalEntry CompanyCodeCurrency
TaxAmountInCoCodeCrcy P_AR_PurVATRateAggregatedAmt2 TaxAmountInCoCodeCrcy
TaxBaseAmountInCoCodeCrcy P_AR_PurVATRateAggregatedAmt2 TaxBaseAmountInCoCodeCrcy
TransactionCurrency P_AR_JournalEntry TransactionCurrency
TaxAmountInTransCrcy P_AR_PurVATRateAggregatedAmt2 TaxAmountInTransCrcy
TaxBaseAmountInTransCrcy P_AR_PurVATRateAggregatedAmt2 TaxBaseAmountInTransCrcy
NmbrOfVATRates NumberOfVATRates NmbrOfVATRates
_OneTimeAccountBP P_AR_JournalEntry _OneTimeAccountBP
@AbapCatalog.sqlViewName: 'PARPURCVATRD'
@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_PurchaseVATRateDetail
  with parameters
    P_RptgAmountIsInTransCrcy : fiar_use_transaction_currency

  as select from           P_AR_PurVATRateAggregatedAmt2 as PurVATRateAggregatedAmt

    inner join             P_AR_JournalEntry             as JournalEntry       on JournalEntry.CompanyCode        = PurVATRateAggregatedAmt.CompanyCode
                                                                              and JournalEntry.FiscalYear         = PurVATRateAggregatedAmt.FiscalYear
                                                                              and JournalEntry.AccountingDocument = PurVATRateAggregatedAmt.AccountingDocument
                                                                              and JournalEntry.ReportingDate      = PurVATRateAggregatedAmt.ReportingDate

    left outer to one join P_AR_NumberOfVATRates         as NumberOfVATRates   on NumberOfVATRates.CompanyCode        = PurVATRateAggregatedAmt.CompanyCode
                                                                              and NumberOfVATRates.FiscalYear         = PurVATRateAggregatedAmt.FiscalYear
                                                                              and NumberOfVATRates.AccountingDocument = PurVATRateAggregatedAmt.AccountingDocument
                                                                              and NumberOfVATRates.TaxType            = 'V'

{
  key JournalEntry.CompanyCode,
  key JournalEntry.FiscalYear,
  key JournalEntry.AccountingDocument,
  key PurVATRateAggregatedAmt.TaxRate as TaxRate,
      JournalEntry.PostingDate,
      JournalEntry.DocumentDate,
      PurVATRateAggregatedAmt.ReportingDate,
      JournalEntry.TaxReportingDate,
      JournalEntry.AccountingDocumentType,
      JournalEntry.DocumentReferenceID,
      JournalEntry.AR_PrintCharacter,
      JournalEntry.AR_Branch,
      JournalEntry.AR_OfficialDocumentNumber,
      PurVATRateAggregatedAmt.CompanyCodeCountry,

      @Semantics.currencyCode:true
      JournalEntry.CompanyCodeCurrency,
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      PurVATRateAggregatedAmt.TaxAmountInCoCodeCrcy,
      @Semantics.amount.currencyCode: 'CompanyCodeCurrency'
      PurVATRateAggregatedAmt.TaxBaseAmountInCoCodeCrcy,

      @Semantics.currencyCode:true
      JournalEntry.TransactionCurrency,
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      PurVATRateAggregatedAmt.TaxAmountInTransCrcy,
      @Semantics.amount.currencyCode: 'TransactionCurrency'
      PurVATRateAggregatedAmt.TaxBaseAmountInTransCrcy,

      @Semantics.currencyCode:true
      cast(
        case $parameters.P_RptgAmountIsInTransCrcy
          when 'X'
            then JournalEntry.TransactionCurrency
          else JournalEntry.CompanyCodeCurrency
        end as glo_reporting_currency preserving type
      )                                     as ReportingCurrency,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
        case $parameters.P_RptgAmountIsInTransCrcy
          when 'X'
            then PurVATRateAggregatedAmt.TaxAmountInTransCrcy
          else PurVATRateAggregatedAmt.TaxAmountInCoCodeCrcy
        end as glo_tax_amount_rptg_crcy preserving type
      )                                     as TaxAmountInRptgCrcy,

      @Semantics.amount.currencyCode: 'ReportingCurrency'
      cast(
        case $parameters.P_RptgAmountIsInTransCrcy
          when 'X'
            then PurVATRateAggregatedAmt.TaxBaseAmountInTransCrcy
          else PurVATRateAggregatedAmt.TaxBaseAmountInCoCodeCrcy
        end as glo_taxbase_amount_rptg_crcy preserving type
      )                                     as TaxBaseAmountInRptgCrcy,

      NumberOfVATRates.NmbrOfVATRates,
      JournalEntry._OneTimeAccountBP
}
// considers the lines with taxes or lines with zero vat but without additional tax lines (<>zero)

where PurVATRateAggregatedAmt.TaxRate <> '0.00' or
    ( PurVATRateAggregatedAmt.TaxRate = '0.00' and ( NumberOfVATRates.NmbrOfVATRates = 0 or NumberOfVATRates.NmbrOfVATRates is null ) )
/*+[internal] {
"BASEINFO":
{
"FROM":
[
"P_AR_JOURNALENTRY",
"P_AR_NUMBEROFVATRATES",
"P_AR_PURVATRATEAGGREGATEDAMT2"
],
"ASSOCIATED":
[
"I_ONETIMEACCOUNTBP"
],
"BASE":
[
"P_AR_JOURNALENTRY"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/