@AbapCatalog.sqlViewName : 'PARDVTAXBASEAMT'
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@ClientHandling.algorithm: #SESSION_VARIABLE
@VDM.private:true
@VDM.viewType: #CONSUMPTION
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
define view P_AR_DailyVATTaxBaseAmount
as select from P_AR_TaxItem
inner join I_JournalEntry as JournalEntry on JournalEntry.CompanyCode = P_AR_TaxItem.CompanyCode
and JournalEntry.FiscalYear = P_AR_TaxItem.FiscalYear
and JournalEntry.AccountingDocument = P_AR_TaxItem.AccountingDocument
//When the document is posted trough SD and the tax rate is zero, the VAT reason should always be read from billing item (not from FI cust. table FIARC_TAXID)
left outer to many join P_AR_BillingDocumentZeroVATRsn as BillingDocumentZeroVatReason on BillingDocumentZeroVatReason.BillingDocument = JournalEntry.OriginalReferenceDocument
{
key P_AR_TaxItem.CompanyCode,
key P_AR_TaxItem.AccountingDocument,
key P_AR_TaxItem.FiscalYear,
P_AR_TaxItem.TaxType,
P_AR_TaxItem.TaxCode,
P_AR_TaxItem.CompanyCodeCurrency,
@Semantics.amount.currencyCode : 'CompanyCodeCurrency'
sum(
distinct
case
when P_AR_TaxItem.TaxRate <> 0 and ( P_AR_TaxItem.StRpTaxClassification = 'VL' or P_AR_TaxItem.StRpTaxClassification = 'TX' )
then P_AR_TaxItem.TaxBaseAmountInCoCodeCrcy
else 0
end
) as TaxedAmountInCoCoCrcy,
@Semantics.amount.currencyCode : 'CompanyCodeCurrency'
sum(
distinct
case
when P_AR_TaxItem.StRpTaxClassification = 'VN' or
( P_AR_TaxItem.StRpTaxClassification = 'TX' and P_AR_TaxItem.TaxRate = 0 and
( ( JournalEntry.ReferenceDocumentType = 'VBRK' and BillingDocumentZeroVatReason.ZeroVATRsn = 'N' ) or
( JournalEntry.ReferenceDocumentType <> 'VBRK' and P_AR_TaxItem.ZeroVATRsn = 'N' ) )
)
then P_AR_TaxItem.TaxBaseAmountInCoCodeCrcy
else 0
end
) as NotTaxedAmount,
@Semantics.amount.currencyCode : 'CompanyCodeCurrency'
sum(
distinct
case
when P_AR_TaxItem.TaxRate = 0 and
( ( JournalEntry.ReferenceDocumentType = 'VBRK' and BillingDocumentZeroVatReason.ZeroVATRsn = 'E' ) or
( JournalEntry.ReferenceDocumentType <> 'VBRK' and P_AR_TaxItem.ZeroVATRsn = 'E' ) )
then P_AR_TaxItem.TaxBaseAmountInCoCodeCrcy
else 0
end
) as TaxExemptionAmount,
@Semantics.amount.currencyCode : 'CompanyCodeCurrency'
sum(
distinct
case
when P_AR_TaxItem.TaxRate = 0 and
( ( JournalEntry.ReferenceDocumentType = 'VBRK' and ( BillingDocumentZeroVatReason.ZeroVATRsn = 'X' or BillingDocumentZeroVatReason.ZeroVATRsn = 'Z' ) ) or
( JournalEntry.ReferenceDocumentType <> 'VBRK' and ( P_AR_TaxItem.ZeroVATRsn = 'X' or P_AR_TaxItem.ZeroVATRsn = 'Z' ) ) )
then P_AR_TaxItem.TaxBaseAmountInCoCodeCrcy
else 0
end
) as ExportOperationTaxAmount,
P_AR_TaxItem._TaxType
}
group by
P_AR_TaxItem.CompanyCode,
P_AR_TaxItem.AccountingDocument,
P_AR_TaxItem.FiscalYear,
P_AR_TaxItem.TaxType,
P_AR_TaxItem.TaxCode,
P_AR_TaxItem.CompanyCodeCurrency
/*+[internal] {
"BASEINFO":
{
"FROM ":
[
"I_JOURNALENTRY",
"P_AR_BILLINGDOCUMENTZEROVATRSN",
"P_AR_TAXITEM"
],
"ASSOCIATED":
[
"I_TAXTYPE"
],
"BASE":
[
"P_AR_TAXITEM"
],
"ANNO_REF":
[],
"SCALAR_FUNCTION":
[],
"VERSION":0,
"ANNOREF_EVALUATION_ERROR":""
}
}*/
Depth:
1
2
3
4
5
All
Reload
P_AR_DailyVATTaxBaseAmount view