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_TW_StRpNotRptdItem.
-- 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: PTWNOTRPTITEM
-- Parameters: P_StatryRptgEntity : srf_reporting_entity, P_StatryRptCategory : srf_rep_cat_id, P_StatryRptRunID : srf_report_run_id, P_StatryRptRunType : srf_report_run_type, P_StatryRptRefNmbrPrefixValue : idtw_ref_num_prefix
CREATE VIEW P_TW_StRpNotRptdItem AS
SELECT
I_StRpTaxItem.CompanyCode AS CompanyCode,
I_StRpTaxItem.AccountingDocument AS AccountingDocument,
I_StRpTaxItem.TaxItem AS TaxItem,
AccountingDocumentItem => TaxItem key I_StRpTaxItem.FiscalYear AS FiscalYear,
I_StRpTaxItemGrpg.TaxGroup AS TaxGroup,
add the key TaxGroup as I_STRPTAXITEMBOXCUBE add it as key to improve performance (avoid to use DISTINCT) key I_StRpTaxItemGrpg.TaxBox AS TaxBox,
add the key TaxBox as I_STRPTAXITEMBOXCUBE add it as key to improve performance (avoid to use DISTINCT) key I_StRpTaxItemGrpg.TaxDeclnAmountType AS TaxDeclnAmountType,
add the key TaxDeclnAmountType as I_STRPTAXITEMBOXCUBE add it as key to improve performance (avoid to use DISTINCT) key I_StRpTaxItem.TransactionTypeDetermination AS TransactionTypeDetermination,
add the key TransactionTypeDetermination as I_STRPTAXITEMBOXCUBE add it as key to improve performance (avoid to use DISTINCT) I_StRpTaxItem.DebitCreditCode AS DebitCreditCode,
I_StRpTaxItem.TaxCode AS TaxCode,
case when (I_StRpTaxItem.DocumentReferenceID = '' or I_StRpTaxItem.DocumentReferenceID is null) and (I_StRpTaxItem._AccountingDocument.NmbrOfPages is null or I_StRpTaxItem._AccountingDocument.NmbrOfPages = '' or I_StRpTaxItem._AccountingDocument.NmbrOfPages is initial) then I_StRpTaxItem.TaxCode when I_StRpTaxItem.DocumentReferenceID is not null then _LeadingTaxCode.TaxCode end as LeadingTaxCode AS TaxCodeendasLeadingTaxCode,
I_StRpTaxItem.TaxRate AS TaxRate,
I_StRpTaxItem.TaxRateValidityStartDate AS TaxRateValidityStartDate,
I_StRpTaxItem.TaxNumber1 AS TaxNumber1,
I_StRpTaxItem.BusinessPartner AS BusinessPartner,
I_StRpTaxItem.TaxType AS TaxType,
I_StRpTaxItem._AccountingDocument.IsReversal AS IsReversal,
I_StRpTaxItem._AccountingDocument.IsReversed AS IsReversed,
I_StRpTaxItem._AccountingDocument.ReverseDocument AS ReverseDocument,
I_StRpTaxItem._AccountingDocument.ReverseDocumentFiscalYear AS ReverseDocumentFiscalYear,
I_StRpTaxItem._AccountingDocument.OriginalReferenceDocument AS OriginalReferenceDocument,
I_StRpTaxItem._AccountingDocument.ReferenceDocumentType AS ReferenceDocumentType,
I_StRpTaxItem._AccountingDocument.NmbrOfPages AS NmbrOfPages,
I_StRpTaxItem.CompanyCodeCurrency AS CompanyCodeCurrency,
I_StRpTaxItem.TaxBaseAmountInCoCodeCrcy AS TaxBaseAmountInCoCodeCrcy,
I_StRpTaxItem.TaxAmountInCoCodeCrcy AS TaxAmountInCoCodeCrcy,
I_StRpTaxItem.PostingDate AS PostingDate,
I_StRpTaxItem.DocumentDate AS DocumentDate,
I_StRpTaxItem.TaxReportingDate AS TaxReportingDate,
I_StRpTaxItem.TaxItemGroup AS TaxItemGroup,
I_StRpTaxItem.AccountingDocumentType AS AccountingDocumentType,
I_StRpTaxItem.GLAccount AS GLAccount,
I_StRpTaxItem.BusinessPlace AS BusinessPlace,
I_StRpTaxItem.TaxJurisdiction AS TaxJurisdiction,
I_StRpTaxItem.LowestLevelTaxJurisdiction AS LowestLevelTaxJurisdiction,
I_StRpTaxItem.ReportingCountry AS ReportingCountry,
I_StRpTaxItemGrpg.TaxItemGroupingVersion AS TaxItemGroupingVersion,
I_StRpTaxItem._AccountingDocument AS _AccountingDocument,
I_StRpTaxItem._ReceivablesPayablesItem AS _ReceivablesPayablesItem,
I_StRpTaxItem._OneTimeAccountBP AS _OneTimeAccountBP,
$parameters.P_StatryRptgEntity AS StatryRptgEntity,
$parameters.P_StatryRptCategory AS StatryRptCategory,
$parameters.P_StatryRptRunID AS StatryRptRunID,
$parameters.P_StatryRptRunType AS StatryRptRunType,
I_StRpTaxItem.DocumentReferenceNumberPrefix AS DocumentReferenceNumberPrefix
LEFT OUTER JOIN I_StRpTaxItemGrpg ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_TW_TaxCode AS _TWTaxCode ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_TW_StRpRptdItem ON /* join condition not captured in parsed metadata */
INNER JOIN P_TW_AcctgDocLeadingTaxCode AS _LeadingTaxCode ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_OperationalAcctgDocItem AS g ON I_StRpTaxItem.CompanyCode = g.CompanyCode AND I_StRpTaxItem.AccountingDocument = g.AccountingDocument AND I_StRpTaxItem.FiscalYear = g.FiscalYear AND I_StRpTaxItem.TaxItemGroup = g.TaxItemGroup -- association [0..1]
LEFT OUTER JOIN I_BillingDocument AS _CheckingBillingDocument ON I_StRpTaxItem.OriginalReferenceDocument = _CheckingBillingDocument.BillingDocument AND I_StRpTaxItem.ReferenceDocumentType = 'VBRK' -- association [0..1]
LEFT OUTER JOIN I_InvoiceList AS _InvoiceList ON I_StRpTaxItem.DocumentReferenceID = _InvoiceList.InvoiceList -- association [0..1]
;