@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'
Depth:
1
2
3
4
5
All
Reload
R_ES_EDCSuplrInvcSIITaxLine view_entity