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_TH_StRpDeferTaxPayment.
-- 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.
-- Parameters: P_RelevantAmountPosition : relevantamountposition, P_StatryRptgEntity : srf_reporting_entity, P_StatryRptCategory : srf_rep_cat_id, P_StatryRptRunID : srf_report_run_id, P_ReportingCountry : land1
CREATE VIEW P_TH_StRpDeferTaxPayment AS
SELECT
I_TransferItem.CompanyCode AS CompanyCode,
I_TransferItem.AccountingDocument AS AccountingDocument,
I_TransferItem.FiscalYear AS FiscalYear,
I_TransferItem.TaxItem AS TaxItem,
I_TransferItem.TaxCode AS TaxCode,
I_TransferItem.TransactionTypeDetermination AS TransactionTypeDetermination,
I_TransferItem.TaxBox AS TaxBox,
I_TransferItem.TaxDeclnAmountType AS TaxDeclnAmountType,
I_TransferItem.TaxItemGroupingVersion AS TaxItemGroupingVersion,
I_TransferItem.TaxBoxStrucValidityStartDate AS TaxBoxStrucValidityStartDate,
I_TransferItem.TaxBoxStructureType AS TaxBoxStructureType,
I_TransferItem.TaxGroup AS TaxGroup,
I_TransferItem.TaxBoxStructure AS TaxBoxStructure,
I_TransferItem.TaxCalculationProcedure AS TaxCalculationProcedure,
I_TransferItem.ReportingDate AS ReportingDate,
I_TransferItem.PostingDate AS PostingDate,
I_TransferItem.DocumentDate AS DocumentDate,
I_TransferItem.TaxReportingDate AS TaxReportingDate,
I_TransferItem.FiscalPeriod AS FiscalPeriod,
I_TransferItem.TaxItemGroup AS TaxItemGroup,
I_TransferItem.AccountingDocumentType AS AccountingDocumentType,
I_TransferItem.ExchangeRate AS ExchangeRate,
P_DebtorCreditorRblsPyblsItem.ClearingDocFiscalYear AS ClearingDocFiscalYear,
P_DebtorCreditorRblsPyblsItem.ClearingAccountingDocument AS ClearingAccountingDocument,
P_DebtorCreditorRblsPyblsItem.ClearingJournalEntry AS ClearingJournalEntry,
P_DebtorCreditorRblsPyblsItem.ClearingJournalEntryFiscalYear AS ClearingJournalEntryFiscalYear,
P_DebtorCreditorRblsPyblsItem._ClearingAccountingDocument.PostingDate AS PaymentDate,
P_DebtorCreditorRblsPyblsItem._ClearingAccountingDocument.ExchangeRate AS SupplierPaytCurrencyExchRate,
P_DebtorCreditorRblsPyblsItem.DocumentItemText AS PaymentNote,
P_DebtorCreditorRblsPyblsItem._ClearingAccountingDocument.DocumentReferenceID AS DocumentReferenceID,
I_TransferItem.CompanyCodeCountry AS CompanyCodeCountry,
I_TransferItem.ReportingCountry AS ReportingCountry,
I_TransferItem.BusinessPartnerCountry AS BusinessPartnerCountry,
cast(I_TransferItem.TaxRate as btaux ) AS TaxRate,
I_TransferItem.TaxRateValidityStartDate AS TaxRateValidityStartDate,
I_TransferItem.IsReversal AS IsReversal,
I_TransferItem.IsReversed AS IsReversed,
I_TransferItem.AccountingDocumentHeaderText AS AccountingDocumentHeaderText,
I_TransferItem.GLAccount AS GLAccount,
I_TransferItem.BusinessPlace AS BusinessPlace,
I_TransferItem.TaxJurisdiction AS TaxJurisdiction,
I_TransferItem.LowestLevelTaxJurisdiction AS LowestLevelTaxJurisdiction,
P_DebtorCreditorRblsPyblsItem._Supplier.TaxNumber1 AS TaxNumber1,
P_DebtorCreditorRblsPyblsItem._Supplier.TaxNumber2 AS TaxNumber2,
P_DebtorCreditorRblsPyblsItem._Supplier.TaxNumber3 AS TaxNumber3,
P_DebtorCreditorRblsPyblsItem.Supplier AS BusinessPartner,
P_DebtorCreditorRblsPyblsItem._Supplier.SupplierName AS BusinessPartnerName,
case when P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.AccountingDocument is null then P_DebtorCreditorRblsPyblsItem._Supplier.AddressID end as AddressID AS AddressIDendasAddressID,
case when P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.AccountingDocument is null then P_DebtorCreditorRblsPyblsItem.Supplier end as Supplier AS SupplierendasSupplier,
concat_with_space(concat_with_space(P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.BusinessPartnerName1,P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.BusinessPartnerName2, 1), concat_with_space(P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.BusinessPartnerName3,P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.BusinessPartnerName4, 1), 1 ) as TaxPayerName AS BusinessPartnerName411asTaxPayerName,
P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.CityName AS CityName,
P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.Region AS Region,
P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.PostalCode AS PostalCode,
P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.StreetAddressName AS StreetName,
coalesce(P_DebtorCreditorRblsPyblsItem._OneTimeAccountBP.Country, P_DebtorCreditorRblsPyblsItem._Supplier.Country ) AS Country,
I_TransferItem.TaxType AS TaxType,
I_TransferItem.CompanyCodeCurrency AS CompanyCodeCurrency,
I_TransferItem.CountryCurrency AS CountryCurrency,
I_TransferItem.DocumentCurrency AS DocumentCurrency,
case $parameters.P_RelevantAmountPosition when '2' then I_TransferItem.AdditionalCurrency1 when '3' then I_TransferItem.AdditionalCurrency2 when '1' then I_TransferItem.CompanyCodeCurrency else I_TransferItem.ReportingCurrency end as ReportingCurrency AS ReportingCurrencyendasReportingCurrency,
I_TransferItem.AdditionalCurrency1 AS AdditionalCurrency1,
I_TransferItem.AdditionalCurrency2 AS AdditionalCurrency2,
cast(I_TransferItem.AmountInTransactionCurrency as fis_wsl) AS AmountInTransactionCurrency,
cast (I_TransferItem.TaxBaseAmountInCoCodeCrcy as hwbas_bses ) AS TaxBaseAmountInCoCodeCrcy,
cast (I_TransferItem.TaxAmountInCoCodeCrcy as hwste) AS TaxAmountInCoCodeCrcy,
cast(I_TransferItem.TaxBaseAmountInTransCrcy as fwbas_bses ) AS TaxBaseAmountInTransCrcy,
cast(I_TransferItem.TaxAmount as fwste ) AS TaxAmount,
I_TransferItem.AmountInAdditionalCurrency1 AS AmountInAdditionalCurrency1,
I_TransferItem.AmountInAdditionalCurrency2 AS AmountInAdditionalCurrency2,
I_TransferItem.TaxBaseAmtInAdditionalCrcy1 AS TaxBaseAmtInAdditionalCrcy1,
I_TransferItem.TaxBaseAmtInAdditionalCrcy2 AS TaxBaseAmtInAdditionalCrcy2,
I_TransferItem.TaxAmountInAdditionalCurrency1 AS TaxAmountInAdditionalCurrency1,
I_TransferItem.TaxAmountInAdditionalCurrency2 AS TaxAmountInAdditionalCurrency2,
I_TransferItem.TaxIsNotDeductible AS TaxIsNotDeductible,
I_TransferItem._TaxTypeText AS _TaxTypeText
FROM I_StRpTaxReturnBoxCube
INNER JOIN P_DefTaxTransfer0 AS P_DefTaxTransfer ON /* join condition not captured in parsed metadata */
INNER JOIN I_OperationalAcctgDocItem AS P_DebtorCreditorRblsPyblsItem ON /* join condition not captured in parsed metadata */
;