R_ES_EDCSuplrInvcSIITaxLine

DDL: R_ES_EDCSUPLRINVCSIITAXLINE Type: view_entity COMPOSITE Package: GLO-EDO-ES-SII-EDC

Spain Supplier Invoice Tax lines

R_ES_EDCSuplrInvcSIITaxLine is a Composite CDS View that provides data about "Spain Supplier Invoice Tax lines" in SAP S/4HANA. It reads from 7 data sources and exposes 13 fields with key fields CompanyCode, AccountingDocument, FiscalYear, TaxCode, TransactionTypeDetermination. Part of development package GLO-EDO-ES-SII-EDC.

Data Sources (7)

SourceAliasJoin Type
P_T007B_GLO AccountingKey inner
I_ES_SIIAccountingDocType CompanyDocTypes inner
R_ES_SIITaxCodeDetail CompanyTaxCodes inner
I_EDCElectronicDocAcctgDoc eDocRelation from
I_JournalEntry JournalEntry inner
I_TaxItem TaxItem inner
I_ES_SIITaxRateDetail TaxRateDecimal inner

Annotations (8)

NameValueLevelField
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.lifecycle.contract.type #SAP_INTERNAL_API view
VDM.viewType #COMPOSITE view
EndUserText.label Spain Supplier Invoice Tax lines view
Metadata.ignorePropagatedAnnotations true view
ObjectModel.usageType.serviceQuality #X view
ObjectModel.usageType.sizeCategory #XL view
ObjectModel.usageType.dataClass #MIXED view

Fields (13)

KeyFieldSource TableSource FieldDescription
KEY CompanyCode I_TaxItem CompanyCode
KEY AccountingDocument I_TaxItem AccountingDocument
KEY FiscalYear I_TaxItem FiscalYear
KEY TaxCode I_TaxItem TaxCode
KEY TransactionTypeDetermination I_TaxItem TransactionTypeDetermination
EDCRepresentationType I_EDCElectronicDocAcctgDoc EDCRepresentationType
EDCRepresentationKey I_EDCElectronicDocAcctgDoc EDCRepresentationKey
TaxRate10endasTaxRate
CompanyCodeCurrencyendendasCurrency
ES_EDocSIITaxClassification R_ES_SIITaxCodeDetail ES_EDocSIITaxClassification
EDCCommonKey I_EDCElectronicDocAcctgDoc EDCCommonKey
EDCRecordUUID I_EDCElectronicDocAcctgDoc EDCRecordUUID
EDCType I_EDCElectronicDocAcctgDoc EDCType
@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.lifecycle.contract.type:#SAP_INTERNAL_API
@VDM.viewType:#COMPOSITE
@EndUserText.label: 'Spain Supplier Invoice Tax lines'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
  serviceQuality: #X,
  sizeCategory: #XL,
  dataClass: #MIXED
}
define view entity R_ES_EDCSuplrInvcSIITaxLine as select from I_EDCElectronicDocAcctgDoc as eDocRelation
inner join I_JournalEntry as JournalEntry on eDocRelation.ElectronicDocCompanyCode = JournalEntry.CompanyCode
                                   and eDocRelation.AccountingDocument = JournalEntry.AccountingDocument
                                   and eDocRelation.FiscalYear = JournalEntry.FiscalYear
inner join I_TaxItem as TaxItem on eDocRelation.ElectronicDocCompanyCode = TaxItem.CompanyCode
                                   and eDocRelation.AccountingDocument = TaxItem.AccountingDocument
                                   and eDocRelation.FiscalYear = TaxItem.FiscalYear
inner join R_ES_SIITaxCodeDetail as CompanyTaxCodes on TaxItem.CompanyCode = CompanyTaxCodes.CompanyCode 
                                                            and TaxItem.TaxCode = CompanyTaxCodes.TaxCode
inner join I_ES_SIIAccountingDocType as CompanyDocTypes on TaxItem.CompanyCode = CompanyDocTypes.CompanyCode 
                                                     and JournalEntry.AccountingDocumentType = CompanyDocTypes.AccountingDocumentType
inner join P_T007B_GLO as AccountingKey on TaxItem.TransactionTypeDetermination = AccountingKey.ktosl
inner join I_ES_SIITaxRateDetail as TaxRateDecimal on TaxItem.ConditionType = TaxRateDecimal.ConditionType
{
  key TaxItem.CompanyCode,
  key TaxItem.AccountingDocument,
  key TaxItem.FiscalYear,
  key TaxItem.TaxCode,
  key TaxItem.TransactionTypeDetermination,
  eDocRelation.EDCRepresentationType,
  eDocRelation.EDCRepresentationKey,
  case
    when TaxRateDecimal.ConditionCalculationTypeShort = 'W'
      then TaxItem.TaxRate * 100
    else
      TaxItem.TaxRate / 10     
  end as TaxRate,
  
  @Semantics.amount.currencyCode: 'Currency'
  case
    when (length(CompanyTaxCodes.ES_EDocSIITaxRegime) = 2 and (CompanyTaxCodes.ES_EDocSIITaxRegime = 'T1' or CompanyTaxCodes.ES_EDocSIITaxRegime = '03'))
          or (length(CompanyTaxCodes.ES_EDocSIITaxRegime) = 3 and substring(CompanyTaxCodes.ES_EDocSIITaxRegime, 1, 2) = 'T1')
          or (CompanyTaxCodes.ES_EDocSIITaxRegime is initial 
              and ((length(CompanyDocTypes.ES_SIITaxRegimeCode) = 2 and CompanyDocTypes.ES_SIITaxRegimeCode = '03') 
                    or (length(CompanyDocTypes.ES_SIITaxRegimeCode) = 3 and substring(CompanyDocTypes.ES_SIITaxRegimeCode, 1, 2) = '03')))
          then cast('0.00' as abap.curr( 23, 2 ))
          else (case 
                    when JournalEntry.CompanyCodeCurrency = 'EUR' 
                    then TaxItem.TaxBaseAmountInCoCodeCrcy
                    else 
                        case 
                            when (TaxItem.TaxReturnCountry is not initial and TaxItem.TaxReturnCountry = 'ES')
                            then TaxItem.TaxBaseAmountInCountryCrcy
                            else TaxItem.TaxBaseAmountInCoCodeCrcy
                        end
                end)
  end as TaxBaseAmountInCoCodeCrcy,
  
  @Semantics.amount.currencyCode: 'Currency'
  case
    when (length(CompanyTaxCodes.ES_EDocSIITaxRegime) = 2 and (CompanyTaxCodes.ES_EDocSIITaxRegime = 'T1' or CompanyTaxCodes.ES_EDocSIITaxRegime = '03'))
          or (length(CompanyTaxCodes.ES_EDocSIITaxRegime) = 3 and substring(CompanyTaxCodes.ES_EDocSIITaxRegime, 1, 2) = 'T1')
          or (CompanyTaxCodes.ES_EDocSIITaxRegime is initial 
              and ((length(CompanyDocTypes.ES_SIITaxRegimeCode) = 2 and CompanyDocTypes.ES_SIITaxRegimeCode = '03') 
                    or (length(CompanyDocTypes.ES_SIITaxRegimeCode) = 3 and substring(CompanyDocTypes.ES_SIITaxRegimeCode, 1, 2) = '03')))
          then cast('0.00' as abap.curr( 23, 2 ))
          else (case 
                    when JournalEntry.CompanyCodeCurrency = 'EUR' 
                    then TaxItem.TaxAmountInCoCodeCrcy
                    else 
                        case 
                            when (TaxItem.TaxReturnCountry is not initial and TaxItem.TaxReturnCountry = 'ES')
                            then TaxItem.TaxAmountInCountryCrcy
                            else TaxItem.TaxAmountInCoCodeCrcy
                        end
                end)
  end as TaxAmountInCoCodeCrcy,      
  
  case 
    when JournalEntry.CompanyCodeCurrency = 'EUR'
         then JournalEntry.CompanyCodeCurrency
         else case when (TaxItem.TaxReturnCountry is not initial and TaxItem.TaxReturnCountry = 'ES') 
                        then TaxItem.CountryCurrency
                        else JournalEntry.CompanyCodeCurrency
              end
  end as Currency,
  
  CompanyTaxCodes.ES_EDocSIITaxClassification,
  
  eDocRelation.EDCCommonKey,
  eDocRelation.EDCRecordUUID,
  eDocRelation.EDCType                                                                                     
} where AccountingKey.stgrp = '2'