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_KR_CASTRPNOTRPTDITEM.-- 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_StatryRptgEntity : srf_reporting_entity, P_StatryRptCategory : srf_rep_cat_id, P_StatryRptRunID : srf_report_run_id, P_StatryRptRunType : srf_report_run_typeCREATE VIEW P_KR_CASTRPNOTRPTDITEM ASSELECT
CATaxRepDoc.CADocumentNumber AS CADocumentNumber,
CATaxRepDoc.CAGLItemNumber AS CAGLItemNumber,
CATaxRepDoc.BusinessPartner AS BusinessPartner,
CATaxRepDoc.CATaxReportingDetailingAssgmt AS CATaxReportingDetailingAssgmt,
CATaxRepDoc.CATaxReportingItemSequenceNmbr AS CATaxReportingItemSequenceNmbr,
$parameters.P_StatryRptgEntity AS StatryRptgEntity,
$parameters.P_StatryRptCategory AS StatryRptCategory,
$parameters.P_StatryRptRunID AS StatryRptRunID,
CATaxRepDoc.CompanyCode AS CompanyCode,
cast(substring (CATaxRepDoc.CASourceDocumentPostingDate, 1, 4) as abap.numc(4)) as FiscalYear AS numc4asFiscalYear,
cast ( '' as belnr_d ) AS AccountingDocument,
cast ( '' as buzei ) AS AccountingDocumentItem,
cast ( '' as buzei ) AS TaxItem,
CATaxRepDoc.TaxCode AS TaxCode,
CATaxRepDoc.CATransactionKeyAccountDetn AS TransactionTypeDetermination,
'' AS TaxBox,
'' AS TaxDeclnAmountType,
'' AS TaxItemGroupingVersion,
cast ( CATaxRepDoc.CATaxRate as figen_tax_rate ) AS TaxRate,
'' AS TaxRateValidityStartDate,
CADocumentBPItem.CAExchangeRate AS ExchangeRate,
CATaxRepDoc.CAReferenceDocument AS ExporterUUID,
CATaxRepDoc.CASourceDocumentDate AS LoadingDate,
CATaxRepDoc.CompanyCodeCurrency AS CompanyCodeCurrency,
'D' AS FinancialAccountType,
CATaxRepDoc.BusinessPlace AS BusinessPlace,
casewhen _Businesspartnertaxnumber2.BPTaxNumber isnot initial then _Businesspartnertaxnumber2.BPTaxNumber else _Businesspartnertaxnumber1.BPTaxNumber endas VATRegistration AS BPTaxNumberendasVATRegistration,
CATaxRepDoc._DocHeader.CADocumentType AS AccountingDocumentType,
CATaxRepDoc.CAReferenceDocument AS DocumentReferenceID,
cast(CATaxRepDoc._DocHeader.CA1stCountrySpecificReference as fikr_cnfrmno) AS TaxInvoiceApprovalNmbr,
cast( CATaxRepDoc._DocHeader.CA1stCountrySpecificReference as fikr_invcno ) AS TaxInvoiceNumber,
'' AS ReversalReason,
CATaxRepDoc.CADocumentHasBeenReversed AS IsReversed,
CATaxRepDoc.CASourceDocumentPostingDate AS PostingDate,
CATaxRepDoc.CASourceDocumentDate AS DocumentDate,
casewhen CATaxRepDoc._DocHeader.TaxReportingDate isnot initial then CATaxRepDoc._DocHeader.TaxReportingDate else CATaxRepDoc._DocHeader.CAPostingDate endas ReportingDate AS CAPostingDateendasReportingDate,
_Businesspartnertaxnumber1.BPTaxNumber AS TaxNumber1,
_Businesspartnertaxnumber2.BPTaxNumber AS TaxNumber2,
CATaxRepDoc._BusinessPartner.BusinessPartnerName AS BusinessPartnerName,
CATaxRepDoc.BusinessPartner AS Customer,
'' AS Suplier,
'' AS IndustryType,
'' AS BusinessType,
'' AS TaxInvoiceRepresentativeName,
'' AS TaxInvcNmbrValidityStartDate,
'A' AS TaxType,
CATaxRepDoc.CATaxBaseAmountInLocalCurrency AS TaxBaseAmountInCoCodeCrcy,
CATaxRepDoc.CATaxAmountInLocalCurrency AS TaxAmountInCoCodeCrcy,
_KR_VAT_Configuration.TaxInvoiceType AS TaxInvoiceType,
CATaxRepDoc._DocHeader.CAFirstCountrySpecificDate AS InvoiceDate,
_KR_VAT_Configuration.ExportType AS ExportType,
_KR_VAT_Configuration.MultipleInvoiceType AS MultipleInvoiceType,
CATaxRepDoc.TransactionCurrency AS DocumentCurrency,
CATaxRepDoc.CATaxBaseAmount AS TaxBaseAmountInTransCrcy,
cast ( '' as glo_tax_item_group ) AS TaxItemGroup,
CATaxRepDoc._DocHeader.CAReconciliationKey AS CAReconciliationKey,
'' AS ReferenceDocumentType,
CADocumentBPItem.CAAccountDeterminationCode AS CAAccountDeterminationCode,
CADocumentBPItem.CAMainTransaction AS CAMainTransaction,
CADocumentBPItem.CASubTransaction AS CASubTransaction,
cast ( CAReportingIdentifier.CADocumentGLItemText as sdata_kk ) AS CATaxReportingAdditionalText,
$parameters.P_StatryRptRunType AS StatryRptRunType,
CATaxRepDoc._DocHeader.ExchangeRateDate AS ExchangeRateDate
LEFTOUTERJOIN I_KR_VATReportingConfiguration AS _KR_VAT_Configuration ON TaxCode = _KR_VAT_Configuration.TaxCode -- association [0..1]LEFTOUTERJOIN I_Businesspartnertaxnumber AS _Businesspartnertaxnumber1 ON CATaxRepDoc.BusinessPartner = _Businesspartnertaxnumber1.BusinessPartner AND _Businesspartnertaxnumber1.BPTaxType = 'KR1' -- association [1..1]LEFTOUTERJOIN I_Businesspartnertaxnumber AS _Businesspartnertaxnumber2 ON CATaxRepDoc.BusinessPartner = _Businesspartnertaxnumber2.BusinessPartner AND _Businesspartnertaxnumber2.BPTaxType = 'KR2' -- association [1..1]LEFTOUTERJOIN I_Customer AS _I_Customer ON CATaxRepDoc.BusinessPartner = _I_Customer.Customer -- association [0..1]LEFTOUTERJOIN I_Supplier AS _I_Supplier ON CATaxRepDoc.BusinessPartner = _I_Supplier.Supplier -- association [0..1]
;