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 C_ID_StRpVATExportCube.
-- 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: CIDSTRVATEXPCUBE
-- Parameters: P_CompanyCode : fis_bukrs, P_FiscalYear : gjahr, P_StatryRptgEntity : srf_reporting_entity, P_StatryRptCategory : srf_rep_cat_id, P_StatryRptRunID : srf_report_run_id, P_ReportingCountry : land1, P_TaxBoxConfiguration : figen_tdt_taxbox_config
CREATE VIEW C_ID_StRpVATExportCube AS
SELECT
I_AccountingDocument.CompanyCode AS CompanyCode,
I_AccountingDocument.AccountingDocument AS AccountingDocument,
I_AccountingDocument.FiscalYear AS FiscalYear,
_TaxItem.TaxBoxStrucValidityStartDate AS TaxBoxStrucValidityStartDate,
_TaxItem.UnifiedTaxBoxStructureType AS UnifiedTaxBoxStructureType,
cast('' as fot_atr_tax_box_struct_type ) AS TaxBoxStructureType,
FiscalPeriod,
PostingDate,
_TaxItem.TaxCode AS TaxCode,
_TaxItem.TaxRateValidityStartDate AS TaxRateValidityStartDate,
_TaxItem.TaxBoxStrucValidityEndDate AS TaxBoxStrucValidityEndDate,
_TaxItem._StRpBPTaxItem.TaxRate AS TaxRate,
_AccDocCust.BusinessPlace AS BusinessPlace,
case when _AccDocCust.Customer != '' then _AccDocCust.Customer else _AccDocCust.Supplier end as CustomerSupplierAccount AS SupplierendasCustomerSupplierAccount,
_AccDocCust.Supplier AS Supplier,
_AccDocCust.Customer AS Customer,
I_AccountingDocument.CompanyCodeCurrency AS CompanyCodeCurrency,
I_AccountingDocument.AccountingDocumentHeaderText AS AccountingDocumentHeaderText,
I_AccountingDocument.Reference1InDocumentHeader AS Reference1InDocumentHeader,
I_AccountingDocument.Reference2InDocumentHeader AS Reference2InDocumentHeader,
I_AccountingDocument.OriginalReferenceDocument AS OriginalReferenceDocument,
case when _AccDocCust.IsNegativePosting = 'X' then _TaxItem.TaxAmount else -(_TaxItem.TaxAmount) end as TaxAmount AS TaxAmountendasTaxAmount,
case when _AccDocCust.IsNegativePosting = 'X' then _TaxItem.LuxuryTaxAmt else -(_TaxItem.LuxuryTaxAmt) end as LuxuryTaxAmt AS LuxuryTaxAmtendasLuxuryTaxAmt,
replace(coalesce(concat(concat(concat( _TaxItem._OneTimeAccountBP.BusinessPartnerName1, _TaxItem._OneTimeAccountBP.BusinessPartnerName2), _TaxItem._OneTimeAccountBP.BusinessPartnerName3), _TaxItem._OneTimeAccountBP.BusinessPartnerName4), coalesce(_Customer.BPCustomerName, _Supplier.BPSupplierName)), ',', ' ' ) as CustomerName AS BPSupplierNameasCustomerName,
coalesce(_TaxItem.AddressLine2, coalesce(concat_with_space(concat_with_space(concat_with_space(concat_with_space(concat_with_space(concat( concat(_Customer._AddressDefaultRepresentation.StreetPrefixName1, ','), _Customer._AddressDefaultRepresentation.StreetPrefixName2), concat_with_space(_Customer._AddressDefaultRepresentation.StreetName, _Customer._AddressDefaultRepresentation.HouseNumber, 1), 1), concat(concat(_Customer._AddressDefaultRepresentation.StreetSuffixName1, ','), _Customer._AddressDefaultRepresentation.StreetSuffixName2), 1), concat(concat(_Customer._AddressDefaultRepresentation.VillageName, ','), _Customer._AddressDefaultRepresentation.DistrictName), 1), concat(concat(_Customer._AddressDefaultRepresentation.CityName, ','), _Customer._AddressDefaultRepresentation.PostalCode), 1), _Customer._AddressDefaultRepresentation.Country, 1), concat_with_space(concat_with_space(concat_with_space(concat_with_space(concat_with_space(concat( concat(_Supplier._AddressDefaultRepresentation.StreetPrefixName1, ','), _Supplier._AddressDefaultRepresentation.StreetPrefixName2), concat_with_space(_Supplier._AddressDefaultRepresentation.StreetName, _Supplier._AddressDefaultRepresentation.HouseNumber, 1), 1), concat(concat(_Supplier._AddressDefaultRepresentation.StreetSuffixName1, ','), _Supplier._AddressDefaultRepresentation.StreetSuffixName2), 1), concat(concat(_Supplier._AddressDefaultRepresentation.VillageName, ','), _Supplier._AddressDefaultRepresentation.DistrictName), 1), concat(concat(_Supplier._AddressDefaultRepresentation.CityName, ','), _Supplier._AddressDefaultRepresentation.PostalCode), 1), _Supplier._AddressDefaultRepresentation.Country, 1))) as CompleteAddress AS Country1asCompleteAddress,
case when _TaxItem._OneTimeAccountBP.TaxID1!='' then replace(replace( _TaxItem._OneTimeAccountBP.TaxID1, '.', '' ),'-','') else case when _AccDocCust.Customer != '' then replace(replace(_Customer.TaxNumber1, '.', '' ),'-','') else replace(replace(_Supplier.TaxNumber1, '.', '' ),'-','') end end as TaxNumber1 AS endendasTaxNumber1
FROM I_AccountingDocument
INNER JOIN I_AcctDocCustomer AS _AccDocCust ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Supplier AS _Supplier ON Supplier = _Supplier.Supplier -- association [0..1]
LEFT OUTER JOIN I_Customer AS _Customer ON Customer = _Customer.Customer -- association [0..1]
;