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_RO_StRpDomesticSlsPurListC.
-- 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: CRODSPLISTC
-- Parameters: P_StatryRptgEntity : srf_reporting_entity, P_StatryRptCategory : srf_rep_cat_id, P_StatryRptRunID : srf_report_run_id
CREATE VIEW C_RO_StRpDomesticSlsPurListC AS
SELECT
strp.CompanyCode AS CompanyCode,
strp.FiscalYear AS FiscalYear,
strp.TaxItem AS TaxItem,
StatryRptgEntity,
StatryRptCategory,
StatryRptRunID,
strp.TaxCode AS TaxCode,
strp.TransactionTypeDetermination AS TransactionTypeDetermination,
strp.TaxBox AS TaxBox,
TaxDeclnAmountType,
cast( strp.TaxBoxStrucValidityStartDate as begda) AS ValidFrom,
_DebtorCreditorRblsPyblsItem.Reference1IDByBusinessPartner AS Reference1IDByBusinessPartner,
cast('000' as farp_buzei) AS AccountingDocumentItem,
TaxGroup,
_AccountingDocument.AccountingDocumentHeaderText AS AccountingDocumentHeaderText,
_AccountingDocument.TransactionCode AS TransactionCode,
strp.AccountingDocument AS InvoiceDocumentNumber,
cast((case when bpty.VATRegistration <> '' and bpty.VATRegistration is not null then bpty.VATRegistration when _DebtorCreditorRblsPyblsItem.VATRegistration <> '' and _DebtorCreditorRblsPyblsItem.VATRegistration is not null then _DebtorCreditorRblsPyblsItem.VATRegistration when _DebtorCreditorRblsPyblsItem._Supplier.VATRegistration <> '' and _DebtorCreditorRblsPyblsItem._Supplier.VATRegistration is not null then _DebtorCreditorRblsPyblsItem._Supplier.VATRegistration when _DebtorCreditorRblsPyblsItem._Customer.VATRegistration <> '' and _DebtorCreditorRblsPyblsItem._Customer.VATRegistration is not null then _DebtorCreditorRblsPyblsItem._Customer.VATRegistration when _OneTimeAccountBP001.TaxID1 <> '' and _OneTimeAccountBP001.TaxID1 is not null then _OneTimeAccountBP001.TaxID1 when strp.TaxNumber1 <> '' and strp.TaxNumber1 is not null then strp.TaxNumber1 when strp.TaxNumber2 <> '' and strp.TaxNumber2 is not null then strp.TaxNumber2 when strp.TaxNumber3 <> '' and strp.TaxNumber3 is not null then strp.TaxNumber3 when strp.Supplier <> '' and SupplierCountry.CountryISOCode = 'GB' and niregions.region is not null and ReportingDate between niprot.BrexitProtocolValidFromDate and niprot.BrexitProtocolValidToDate then S.TaxNumber6 when strp.Customer <> '' and CustomerCountry.CountryISOCode = 'GB' and niregions.region is not null and ReportingDate between niprot.BrexitProtocolValidFromDate and niprot.BrexitProtocolValidToDate then C.TaxNumber6 end) as stceg) as VATRegistration AS TaxNumber6endasstcegasVATRegistration,
case when strp._DebtorCreditorRblsPyblsItem._Customer.Customer <> '' then coalesce(_OneTimeAccountBP001.Country, strp._DebtorCreditorRblsPyblsItem._Customer.Country) when strp._DebtorCreditorRblsPyblsItem._Supplier.Supplier <> '' then coalesce(_OneTimeAccountBP001.Country ,strp._DebtorCreditorRblsPyblsItem._Supplier.Country) end as Country AS CountryendasCountry,
case when strp._DebtorCreditorRblsPyblsItem._Customer.Customer <> '' then coalesce(_OneTimeAccountBP001.Region, strp._DebtorCreditorRblsPyblsItem._Customer.Region) when strp._DebtorCreditorRblsPyblsItem._Supplier.Supplier <> '' then coalesce(_OneTimeAccountBP001.Region ,strp._DebtorCreditorRblsPyblsItem._Supplier.Region) end as Region AS RegionendasRegion,
cast(case when strp._DebtorCreditorRblsPyblsItem._Customer.Customer <> '' then coalesce(_OneTimeAccountBP001.TaxID4, strp._DebtorCreditorRblsPyblsItem._Customer.TaxNumber4) when strp._DebtorCreditorRblsPyblsItem._Supplier.Supplier <> '' then coalesce(_OneTimeAccountBP001.TaxID4 ,strp._DebtorCreditorRblsPyblsItem._Supplier.TaxNumber4) end as stcd4) as TaxNumber4 AS TaxNumber4endasstcd4asTaxNumber4,
cast(case when strp._DebtorCreditorRblsPyblsItem._Customer.Customer <> '' then coalesce(_OneTimeAccountBP001.TaxID5, strp._DebtorCreditorRblsPyblsItem._Customer.TaxNumber5) when strp._DebtorCreditorRblsPyblsItem._Supplier.Supplier <> '' then coalesce(_OneTimeAccountBP001.TaxID5 ,strp._DebtorCreditorRblsPyblsItem._Supplier.TaxNumber5) end as stcd5) as TaxNumber5 AS TaxNumber5endasstcd5asTaxNumber5,
case when strp._DebtorCreditorRblsPyblsItem._Customer.Customer <> '' then strp._DebtorCreditorRblsPyblsItem._Customer.TaxNumber6 when strp._DebtorCreditorRblsPyblsItem._Supplier.Supplier <> '' then strp._DebtorCreditorRblsPyblsItem._Supplier.TaxNumber6 end as TaxNumber6 AS TaxNumber6endasTaxNumber6,
strp.PostingDate AS PostingDate,
strp.DocumentDate AS DocumentDate,
strp.TaxReportingDate AS TaxReportingDate,
ReportingDate,
strp.FiscalPeriod AS FiscalPeriod,
strp.AccountingDocumentType AS AccountingDocumentType,
strp.DocumentReferenceID AS DocumentReferenceID,
CompanyCodeCountry,
ReportingCountry,
TaxReturnCountry,
strp.ExchangeRate AS ExchangeRate,
case when TaxRate < 0 then division( -1 * strp.TaxRate , 1, 0) else division(strp.TaxRate , 1, 0) end as TaxRate AS TaxRate10endasTaxRate,
strp.GLAccount AS GLAccount,
strp.BusinessPlace AS BusinessPlace,
strp.TaxJurisdiction AS TaxJurisdiction,
LowestLevelTaxJurisdiction,
cast(strp.TaxNumber1 as stcd1) AS TaxNumber1,
cast(strp.TaxNumber2 as stcd2) AS TaxNumber2,
strp.TaxNumber3 AS TaxNumber3,
strp.BusinessPartner AS BusinessPartner,
strp.Supplier AS Supplier,
strp.Customer AS Customer,
cast(CustomerSupplierAddress as glo_address) AS CustomerSupplierAddress,
strp.IsReversal AS IsReversal,
strp.IsReversed AS IsReversed,
strp.TaxType AS TaxType,
TargetTaxCode,
ReportingCurrency,
TaxGroupFreeClassification,
TaxIsNotDeductible,
_OneTimeAccountBP001.CityName AS CityName
LEFT OUTER JOIN I_OperationalAcctgDocItem AS oadi ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_DomainFixedValue AS dv ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_RO_BusinessPartnerTaxType AS bpty ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Supplier AS S ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Customer AS C ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Country AS SupplierCountry ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_Country AS CustomerCountry ON /* join condition not captured in parsed metadata */
INNER JOIN I_BrexitProtocolValidity AS niprot ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_niprotocolregions ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_JournalEntry AS ReverseDocumentJournalEntry ON /* join condition not captured in parsed metadata */
;