P_NL_SAFTTaxRatioCalculation is a Composite CDS View in SAP S/4HANA. It reads from 1 data source (I_SAFTJournalLineItem) and exposes 41 fields with key fields CompanyCode, FiscalYear, AccountingDocument, LedgerGLLineItem, Ledger.
Derived SQL interpretation, reconstructed from the parsed view metadata (data sources, associations, and field mappings). SAP annotations are omitted and the structure is reformulated as SQL — this is a functional approximation, not the verbatim SAP source.
-- Derived SQL interpretation of CDS view P_NL_SAFTTaxRatioCalculation.-- Reconstructed from parsed metadata (data sources, associations, fields).-- SAP annotations are omitted and the structure is reformulated as SQL;-- this is a functional approximation, not the verbatim SAP source. Some join-- conditions may be unavailable and a few CDS constructs are kept as-is.-- SQL view name: PNLSAFTTAXRCCREATE VIEW P_NL_SAFTTaxRatioCalculation ASSELECT
JournalEntryItem.CompanyCode AS CompanyCode,
JournalEntryItem.FiscalYear AS FiscalYear,
JournalEntryItem.AccountingDocument AS AccountingDocument,
JournalEntryItem.LedgerGLLineItem AS LedgerGLLineItem,
JournalEntryItem.Ledger AS Ledger,
JournalEntryItem.SourceLedger AS SourceLedger,
JournalEntryItem.ChartOfAccounts AS ChartOfAccounts,
JournalEntryItem.PostingDate AS PostingDate,
JournalEntryItem.FinancialAccountType AS FinancialAccountType,
JournalEntryItem.GLAccount AS GLAccount,
JournalEntryItem.AlternativeGLAccount AS AlternativeGLAccount,
JournalEntryItem.ReferenceDocument AS ReferenceDocument,
JournalEntryItem.DocumentItemText AS DocumentItemText,
JournalEntryItem.CompanyCodeCurrency AS CompanyCodeCurrency,
JournalEntryItem.TransactionCurrency AS TransactionCurrency,
casewhen JournalEntryItem.AccountingDocumentItemType <> 'T' and JournalEntryItem.ReconciliationAccountType <> 'V' and JournalEntryItem.FinancialAccountType = 'S' then JournalEntryItem.TaxCode else ' ' endas TaxCode AS TaxCodeelseendasTaxCode,
casewhen JournalEntryItem.AccountingDocumentItemType <> 'T' and JournalEntryItem.ReconciliationAccountType <> 'V' and JournalEntryItem.FinancialAccountType = 'S' then coalesce(division(abs(TaxAmountSum.TaxRate),10,2) , 0) else 0 endas TaxRate AS TaxRate1020else0endasTaxRate,
casewhen TaxAmountSum.TaxAmountInCoCodeCrcy isnot initial and TaxAmountSum.TaxAmountInCoCodeCrcy isnotnulland JournalItemTaxSum.TotalGrossAmountInCoCodeCrcy isnot initial and JournalItemTaxSum.TotalGrossAmountInCoCodeCrcy isnotnulland JournalEntryItem.AccountingDocumentItemType <> 'T' and JournalEntryItem.ReconciliationAccountType <> 'V' and JournalEntryItem.FinancialAccountType = 'S' then ( cast( TaxAmountSum.TaxAmountInCoCodeCrcy as abap.fltp) * (cast( abs(JournalEntryItem.AmountInCompanyCodeCurrency) as abap.fltp) / cast( JournalItemTaxSum.TotalGrossAmountInCoCodeCrcy as abap.fltp))) else 0 endas TaxRatioCalculated AS fltpelse0endasTaxRatioCalculated,
casewhen TaxAmountSum.TaxBaseAmountInCoCodeCrcy isnot initial and TaxAmountSum.TaxBaseAmountInCoCodeCrcy isnotnulland JournalItemTaxSum.TotalGrossAmountInCoCodeCrcy isnot initial and JournalItemTaxSum.TotalGrossAmountInCoCodeCrcy isnotnulland JournalEntryItem.AccountingDocumentItemType <> 'T' and JournalEntryItem.ReconciliationAccountType <> 'V' and JournalEntryItem.FinancialAccountType = 'S' then ( cast( TaxAmountSum.TaxBaseAmountInCoCodeCrcy as abap.fltp) * (cast( abs(JournalEntryItem.AmountInCompanyCodeCurrency) as abap.fltp) / cast( JournalItemTaxSum.TotalGrossAmountInCoCodeCrcy as abap.fltp))) else 0 endas TaxBaseRatioCalculated AS fltpelse0endasTaxBaseRatioCalculated,
casewhen TaxAmountSum.TaxBaseAmountInTransCrcy isnot initial and TaxAmountSum.TaxBaseAmountInTransCrcy isnotnulland JournalItemTaxSum.TotalGrossAmountInTransCrcy isnot initial and JournalItemTaxSum.TotalGrossAmountInTransCrcy isnotnulland JournalEntryItem.AccountingDocumentItemType <> 'T' and JournalEntryItem.ReconciliationAccountType <> 'V' and JournalEntryItem.FinancialAccountType = 'S' then ( cast( TaxAmountSum.TaxBaseAmountInTransCrcy as abap.fltp) * (cast( abs(JournalEntryItem.AmountInTransactionCurrency) as abap.fltp) / cast( JournalItemTaxSum.TotalGrossAmountInTransCrcy as abap.fltp))) else 0 endas TaxBaseRatioCalculatedTC AS fltpelse0endasTaxBaseRatioCalculatedTC,
cast( abs(round( JournalEntryItem.Quantity, 0)) as abap.int8 ) AS Quantity,
JournalEntryItem.CostCenter AS CostCenter,
JournalEntryItem.ControllingArea AS ControllingArea,
JournalEntryItem.Customer AS Customer,
JournalEntryItem.Supplier AS Supplier,
JournalEntryItem.ReferenceDocumentType AS ReferenceDocumentType,
JournalEntryItem.LogicalSystem AS LogicalSystem,
JournalEntryItem.ReferenceSDDocument AS ReferenceSDDocument,
JournalEntryItem.ExchangeRate AS ExchangeRate,
JournalEntryItem._CompanyCode AS _CompanyCode,
JournalEntryItem._FiscalYear AS _FiscalYear,
JournalEntryItem._JournalEntry AS _JournalEntry,
JournalEntryItem._Ledger AS _Ledger,
JournalEntryItem._Supplier AS _Supplier,
JournalEntryItem._Customer AS _Customer,
JournalEntryItem._CustomerToBP AS _CustomerToBP,
JournalEntryItem._SupplierToBP AS _SupplierToBP,
JournalEntryItem._CFinPurchasingDocHistory AS _CFinPurchasingDocHistory,
JournalEntryItem._CompanyCodeCurrency AS _CompanyCodeCurrency,
JournalEntryItem._CostCenter AS _CostCenter,
JournalEntryItem._ControllingArea AS _ControllingArea
FROM I_SAFTJournalLineItem AS JournalEntryItem
;