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_MX_DIOTTaxItemTaxBox.
-- 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_CompanyCode : fis_bukrs, P_FiscalYear : fis_gjahr, P_StatryRptgEntity : srf_reporting_entity, P_StatryRptCategory : srf_rep_cat_id, P_StatryRptRunID : srf_report_run_id, P_Ledger : fins_ledger
CREATE VIEW P_MX_DIOTTaxItemTaxBox AS
SELECT
TaxItem.CompanyCode AS CompanyCode,
TaxItem.AccountingDocument AS AccountingDocument,
TaxItem.AccountingDocumentItem AS AccountingDocumentItem,
TaxItem.FiscalYear AS FiscalYear,
TaxItem.StatryRptCategory AS StatryRptCategory,
TaxItem.StatryRptgEntity AS StatryRptgEntity,
TaxItem.StatryRptRunID AS StatryRptRunID,
TaxItem.TaxTransferDocument AS TaxTransferDocument,
TaxItem.TaxTransferDocumentYear AS TaxTransferDocumentYear,
TaxItem.TaxCode AS TaxCode,
TaxItem.TaxBox AS TaxBox,
TaxItem.TaxDeclnAmountType AS TaxDeclnAmountType,
TaxItem.MX_DIOTOperationType AS MX_DIOTOperationType,
TaxItem.MX_SupplierType AS MX_SupplierType,
TaxItem.Supplier AS Supplier,
TaxItem.ReportingCurrency AS ReportingCurrency,
TaxItem.TaxNumber1 AS TaxNumber1,
TaxItem.TaxNumberResponsible AS TaxNumberResponsible,
TaxItem.BusinessPartnerName AS BusinessPartnerName,
TaxItem.Country AS Country,
TaxItem.CountryThreeLetterISOCode AS CountryThreeLetterISOCode,
TaxItem.NationalityName AS NationalityName,
TaxItem.MX_FullAddressText AS MX_FullAddressText,
TaxItem.MX_FiscalEffectManifest AS MX_FiscalEffectManifest,
TaxItem.MX_BorderClassification AS MX_BorderClassification,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '08' and TaxItem.MX_BorderClassification = 1 then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox08AmtInReportingCurrency AS 00endasTaxBox08AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '09' and TaxItem.MX_BorderClassification = 1 then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox09AmtInReportingCurrency AS 00endasTaxBox09AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '10' and TaxItem.MX_BorderClassification = 2 then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox10AmtInReportingCurrency AS 00endasTaxBox10AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '11' and TaxItem.MX_BorderClassification = 2 then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox11AmtInReportingCurrency AS 00endasTaxBox11AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '12' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox12AmtInReportingCurrency AS 00endasTaxBox12AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '13' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox13AmtInReportingCurrency AS 00endasTaxBox13AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '14' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox14AmtInReportingCurrency AS 00endasTaxBox14AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '15' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox15AmtInReportingCurrency AS 00endasTaxBox15AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '16' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox16AmtInReportingCurrency AS 00endasTaxBox16AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '17' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox17AmtInReportingCurrency AS 00endasTaxBox17AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '18' and TaxItem.MX_BorderClassification = 1 then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox18AmtInReportingCurrency AS 00endasTaxBox18AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '19' and TaxItem.MX_BorderClassification = 1 then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox19AmtInReportingCurrency AS 00endasTaxBox19AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '20' and TaxItem.MX_BorderClassification = 2 then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox20AmtInReportingCurrency AS 00endasTaxBox20AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '21' and TaxItem.MX_BorderClassification = 2 then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox21AmtInReportingCurrency AS 00endasTaxBox21AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '22' then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox22AmtInReportingCurrency AS 00endasTaxBox22AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '23' then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox23AmtInReportingCurrency AS 00endasTaxBox23AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '24' then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox24AmtInReportingCurrency AS 00endasTaxBox24AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '25' then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox25AmtInReportingCurrency AS 00endasTaxBox25AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '26' then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox26AmtInReportingCurrency AS 00endasTaxBox26AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'T' and TaxItem.TaxBox = '27' then TaxItem.TaxAmountInRptgCrcy else abap.curr'0.00' end as TaxBox27AmtInReportingCurrency AS 00endasTaxBox27AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '49' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox29AmtInReportingCurrency AS 00endasTaxBox29AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '50' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox30AmtInReportingCurrency AS 00endasTaxBox30AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '51' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox31AmtInReportingCurrency AS 00endasTaxBox31AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '52' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox32AmtInReportingCurrency AS 00endasTaxBox32AmtInReportingCurrency,
case when TaxItem.TaxDeclnAmountType = 'B' and TaxItem.TaxBox = '53' then TaxItem.TaxBaseAmountInRptgCrcy else abap.curr'0.00' end as TaxBox33AmtInReportingCurrency AS 00endasTaxBox33AmtInReportingCurrency
FROM I_MX_DIOTTxItmBusinessPartner
;