@AbapCatalog.sqlViewName: 'CARFORM731LGC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@ObjectModel.usageType.sizeCategory: #XL
@ObjectModel.usageType.serviceQuality: #D
@ObjectModel.usageType.dataClass: #MIXED
@EndUserText.label: 'Argentina VAT Form 731 with Rptd item log data'
@AccessControl.personalData.blocking: #BLOCKED_DATA_INCLUDED
@VDM.viewType: #CONSUMPTION
@ClientHandling.algorithm: #SESSION_VARIABLE
@Analytics.dataCategory: #CUBE
@Metadata.allowExtensions:true
define view C_AR_StRpVATForm731ItemLogC
as select distinct from I_StRpTaxItem as TaxItem
left outer join I_AR_TaxClassIdentification on (I_AR_TaxClassIdentification.TaxCode = TaxItem.TaxCode
and I_AR_TaxClassIdentification.TransactionTypeDetermination = TaxItem.TransactionTypeDetermination ) or
(I_AR_TaxClassIdentification.TaxCode = ''
and I_AR_TaxClassIdentification.TransactionTypeDetermination = TaxItem.TransactionTypeDetermination)
left outer join I_Customer on TaxItem.BusinessPartner = I_Customer.Customer
left outer join I_Supplier on TaxItem.BusinessPartner = I_Supplier.Supplier
left outer join I_Withholdingtaxitem as _Withholdingtaxitem
on TaxItem.CompanyCode = _Withholdingtaxitem.CompanyCode
and TaxItem.AccountingDocument = _Withholdingtaxitem.AccountingDocument
and TaxItem.FiscalYear = _Withholdingtaxitem.FiscalYear
left outer join I_GLAccountLineItem on TaxItem.CompanyCode = I_GLAccountLineItem.CompanyCode
and TaxItem.GLAccount = I_GLAccountLineItem.GLAccount
{
key TaxItem.CompanyCode,
key TaxItem.AccountingDocument,
key TaxItem.FiscalYear,
key TaxItem.TaxItem,
key TaxItem.TransactionTypeDetermination,
key TaxItem.TaxCode,
TaxItem.TaxReportingDate,
TaxItem.GLAccount,
TaxType,
TaxItem.PostingDate,
ReportingDate,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
I_GLAccountLineItem.AmountInCompanyCodeCurrency,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
/*TBD: TaxBaseAmountInCoCodeCrcy returned as saved in DB. Recalculation necessary in some cases. Correct value in I_TaxDeclReconciliationCube.*/
TaxBaseAmountInCoCodeCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
TaxAmountInCoCodeCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'DocumentCurrency'
TaxBaseAmountInTransCrcy,
//@DefaultAggregation:#SUM
//@Semantics.amount.currencyCode: 'DocumentCurrency'
//TaxAmountInTransCrcy,
//TaxJurisdiction,
TaxReturnCountry,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CountryCurrency'
TaxAmountInCountryCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CountryCurrency'
TaxBaseAmountInCountryCrcy,
@Semantics.currencyCode:true
TaxItem.CompanyCodeCurrency,
CompanyCodeCountry,
@Semantics.currencyCode:true
TaxItem.DocumentCurrency,
@Semantics.currencyCode:true
CountryCurrency,
TaxItem.TaxCalculationProcedure,
StRpTaxClassification,
AddressRegion,
CustomerCounty,
MunicipalJurisdiction,
ZeroVATRsn,
TaxIsProRated,
I_Customer.ResponsibleType,
I_Customer.Customer,
I_Supplier.Supplier,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '01' or I_Supplier.ResponsibleType = '01' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
end
end as RegisteredBPTaxBaseAmount,//AmtznAdjmtLossAllwncInPosCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '01' or I_Supplier.ResponsibleType = '01' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxAmountInCoCodeCrcy
end
end as RegisteredBPTaxAmount, //IdxClnAmtznAdjLossAllInPosCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '02' or I_Supplier.ResponsibleType = '02' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
end
end as NotRegisteredBPTaxBaseAmount,//FXAmtznAdjLossAllwncInValnCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '02' or I_Supplier.ResponsibleType = '02' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxAmountInCoCodeCrcy
end
end as TxBaseAmtWithTxRate18InCCCrcy, //PriceVariance,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '02' or I_Supplier.ResponsibleType = '02' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxAmountInCoCodeCrcy
when 'VS'
then
TaxAmountInCoCodeCrcy
end
end as TxBaseAmtWithTxRate0InCCCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '02' or I_Supplier.ResponsibleType = '02' )
then
case substring(StRpTaxClassification,1,2)
when 'VS'
then
TaxAmountInCoCodeCrcy
end
end as TxBaseAmtWithTxRate10InCCCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '03' or I_Supplier.ResponsibleType = '03'
or I_Customer.ResponsibleType = '04' or I_Supplier.ResponsibleType = '04'
or I_Customer.ResponsibleType = '05' or I_Supplier.ResponsibleType = '05')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
when 'VN'
then
TaxBaseAmountInCoCodeCrcy
when 'VL'
then
TaxBaseAmountInCoCodeCrcy
end
end as ExemptedConsumerTaxBaseAmount,//FrgnExchContrChgAmtInValnCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '03' or I_Supplier.ResponsibleType = '03'
or I_Customer.ResponsibleType = '04' or I_Supplier.ResponsibleType = '04'
or I_Customer.ResponsibleType = '05' or I_Supplier.ResponsibleType = '05')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxAmountInCoCodeCrcy
when 'VN'
then
TaxAmountInCoCodeCrcy
when 'VL'
then
TaxAmountInCoCodeCrcy
end
end as ExemptedConsumerTaxAmount,//ContractChangeAmtInValnCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '06' or I_Supplier.ResponsibleType = '06' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
end
end as RegimeTaxBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( I_Customer.ResponsibleType = '06' or I_Supplier.ResponsibleType = '06' )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxAmountInCoCodeCrcy
end
end as RegimeTaxAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( (I_Customer.ResponsibleType <> '01' or I_Supplier.ResponsibleType <> '01')
and ( I_Customer.ResponsibleType <> '02' or I_Supplier.ResponsibleType <> '02' )
and ( I_Customer.ResponsibleType <> '03' or I_Supplier.ResponsibleType <> '03')
and ( I_Customer.ResponsibleType <> '04' or I_Supplier.ResponsibleType <> '04')
and ( I_Customer.ResponsibleType <> '05' or I_Supplier.ResponsibleType <> '05')
and ( I_Customer.ResponsibleType <> '06' or I_Supplier.ResponsibleType <> '06')
and ( I_Customer.ResponsibleType <> '08' or I_Supplier.ResponsibleType <> '08' ) )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
end
end as ExportOperationTaxBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when ( (I_Customer.ResponsibleType <> '01' or I_Supplier.ResponsibleType <> '01')
and ( I_Customer.ResponsibleType <> '02' or I_Supplier.ResponsibleType <> '02' )
and ( I_Customer.ResponsibleType <> '03' or I_Supplier.ResponsibleType <> '03')
and ( I_Customer.ResponsibleType <> '04' or I_Supplier.ResponsibleType <> '04')
and ( I_Customer.ResponsibleType <> '05' or I_Supplier.ResponsibleType <> '05')
and ( I_Customer.ResponsibleType <> '06' or I_Supplier.ResponsibleType <> '06')
and ( I_Customer.ResponsibleType <> '08' or I_Supplier.ResponsibleType <> '08' ) )
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxAmountInCoCodeCrcy
end
end as ExportOperationTaxAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when (ZeroVATRsn = 'N' or ZeroVATRsn = 'E')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
when 'VL'
then
TaxBaseAmountInCoCodeCrcy
when 'VN'
then
TaxBaseAmountInCoCodeCrcy
end
end as ExemptedICMSAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.ResponsibleType = '01'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then // change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxBaseAmountInCoCodeCrcy
end // end of change
end
end as FixedAssetAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.ResponsibleType = '01'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then //change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxAmountInCoCodeCrcy
end // end of change
end
end as FixedAssetTaxAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.ResponsibleType = '02'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then //change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxBaseAmountInCoCodeCrcy
end // end of change
end
end as NotRegisteredFixedAssetBaseAmt,//AmortizedCostInValuationCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.ResponsibleType = '02'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then // change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxAmountInCoCodeCrcy
end // end of change
end
end as NotRegisteredFixedAssetTaxAmt,//FXOffstLossAllwncAmtInValnCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when (I_Customer.ResponsibleType = '03'
or I_Customer.ResponsibleType = '04'
or I_Customer.ResponsibleType = '05')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then //change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxBaseAmountInCoCodeCrcy
end // end of change
end
end as ExemptedSimpfdRegimeTaxBaseAmt,//FXOffstOCILossAllwncInValnCrcy,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when (I_Customer.ResponsibleType = '03'
or I_Customer.ResponsibleType = '04'
or I_Customer.ResponsibleType = '05')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then //change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxAmountInCoCodeCrcy
end // end of change
end
end as ExemptedSimpfdRegimeTaxAmount,//OCIOffstLossAllwncAmtInPosCrcy,//
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'PG'
then
TaxAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'PG'
then
TaxAmountInCoCodeCrcy
end
end
end
end as PurchaseOfGoodsCreditAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'PG'
then
TaxBaseAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'PG'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
end as CalculatedTxBaseAmtInTransCrcy,//BPCrdtPurGoodsBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'SV'
then
TaxAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'SV'
then
TaxAmountInCoCodeCrcy
end
end
end
end as ServiceCreditTaxAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'SV'
then
TaxBaseAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'SV'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
end as OCIOffstLossAllwncInValnCrcy,//BPCrdtServicesBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'RT'
then
TaxAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'RT'
then
TaxAmountInCoCodeCrcy
end
end
end
end as RentsCreditTaxAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'RT'
then
TaxBaseAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'RT'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
end as WhldgTxIncAmtInRptgCurrency,//BPCrdtRentBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'TX' //change
then
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxAmountInCoCodeCrcy
end
end // end of change
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'TX' //chane
then
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxAmountInCoCodeCrcy
end
end // end of change
end
end
end as FixedAssetCreditTaxAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'TX' //change
then
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then //change
case I_AR_TaxClassIdentification.GLBusinessTransactionType
when 'FA'
then
TaxBaseAmountInCoCodeCrcy
end
end // end of change4
end
end
end as IdxClnAmortizedCostInPosCrcy,//BPCrdtFixedAssetBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'OT'
then
TaxAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'OT'
then
TaxAmountInCoCodeCrcy
end
end
end
end as CreditAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'OT'
then
TaxBaseAmountInCoCodeCrcy
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case substring(StRpTaxClassification,1,2)
when 'OT'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
end as AmortizedCostInPositionCrcy,//BPCrdtOtherBaseAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Customer.Customer is not null
then
case
when I_Customer.Country = 'AR'
then
case when (ZeroVATRsn = 'X' or ZeroVATRsn = 'Z')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
else
case
when I_Supplier.Supplier is not null
then
case
when I_Supplier.Country = 'AR'
then
case when (ZeroVATRsn = 'X' or ZeroVATRsn = 'Z')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
end
end as ExportAmountInCompanyCodeCrcy,
//////////////////////////////////////////Purchase//////////////////////////////////////////////
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Supplier.ResponsibleType = '01'
then
case when (ZeroVATRsn = 'N' or ZeroVATRsn = 'E')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
else
case substring(StRpTaxClassification,1,2)
when 'VN'
then
TaxBaseAmountInCoCodeCrcy
else
case substring(StRpTaxClassification,1,2)
when 'VL'
then
TaxBaseAmountInCoCodeCrcy
end
end
end
end
end as NotTaxedAmount,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Supplier.ResponsibleType = '02'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
when 'VN'
then
TaxBaseAmountInCoCodeCrcy
when 'VL'
then
TaxBaseAmountInCoCodeCrcy
end
end as NotRegisteredTaxBaseAmount, //VolumeVariance,//,
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when I_Supplier.ResponsibleType = '06'
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
when 'VN'
then
TaxBaseAmountInCoCodeCrcy
when 'VL'
then
TaxBaseAmountInCoCodeCrcy
end
end as SimplifiedRegimeTaxBaseAmount, //LossAllowanceAmountInValnCrcy,//
@DefaultAggregation:#SUM
@Semantics.amount.currencyCode: 'CompanyCodeCurrency'
case
when (I_Supplier.ResponsibleType <> '01'
and I_Supplier.ResponsibleType <> '02'
and I_Supplier.ResponsibleType <> '06')
then
case substring(StRpTaxClassification,1,2)
when 'TX'
then
TaxBaseAmountInCoCodeCrcy
when 'VN'
then
TaxBaseAmountInCoCodeCrcy
when 'VL'
then
TaxBaseAmountInCoCodeCrcy
end
end as OtherPurchasesTaxBaseAmount,
_DebtorCreditorRblsPyblsItem.FinancialAccountType,
I_AR_TaxClassIdentification.GLBusinessTransactionType,
TaxItem._ReportedItemsLog.StatryRptCategory,
TaxItem._ReportedItemsLog.StatryRptgEntity,
TaxItem._ReportedItemsLog.StatryRptRunID
// I_Customer.ResponsibleType as TestRespType,
}