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_ResolvedDisputeCase1.
-- 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: PRESLVDDISPCASE1
-- Parameters: P_KeyDate : sydate, P_DisplayCurrency : vdm_v_display_currency, P_ExchangeRateType : kurst_curr
CREATE VIEW P_ResolvedDisputeCase1 AS
SELECT
I_DisputeCase.DisputeCaseUUID AS DisputeCaseUUID,
I_CaseAttributes.CaseID AS CaseID,
I_DisputeCase.CompanyCode AS CompanyCode,
I_DisputeCase.Customer AS Customer,
I_CaseAttributes.CaseProcessor AS DisputeCaseProcessor,
I_CaseAttributes.DisputeCaseProcessorFullName AS DisputeCaseProcessorFullName,
I_CaseAttributes.CaseReason AS DisputeCaseReason,
I_CaseAttributes.DisputeCasePriority AS DisputeCasePriority,
I_DisputeCase.DisputeCaseRootCause AS DisputeCaseRootCause,
I_DisputeCase.DisputeCaseCoordinator AS DisputeCaseCoordinator,
I_DisputeCase.DsputCaseCoordinatorFullName AS DsputCaseCoordinatorFullName,
I_CaseAttributes.CreationDateTime AS CreationDateTime,
I_CaseAttributes.CloseDateTime AS CloseDateTime,
I_DisputeCase.Status AS Status,
I_CaseAttributes.CaseProcessingStatus AS CaseProcessingStatus,
I_CaseAttributes.CaseStatusProfile AS StatusProfile,
I_CaseAttributes.CaseType AS CaseType,
I_DisputeCase.OriginalAmount AS OriginalAmount,
cast( I_DisputeCase.Currency as currency ) AS Currency,
currency_conversion( amount => I_DisputeCase.OriginalAmount, source_currency => I_DisputeCase.Currency, target_currency => :P_DisplayCurrency, exchange_rate_date => :P_KeyDate , exchange_rate_type => :P_ExchangeRateType, error_handling => #CNV_ERROR_HANDLING.FAIL_ON_ERROR, round => #CDSBoolean.true, decimal_shift => #CDSBoolean.true, decimal_shift_back => #CDSBoolean.true ) as OriginalAmountInDisplayCrcy AS trueasOriginalAmountInDisplayCrcy,
cast( :P_DisplayCurrency as disp_curr ) AS DisplayCurrency,
substring( :P_KeyDate,1,4 ) AS CurrentYear,
substring( :P_KeyDate,5,2 ) AS CurrentMonth,
dats_add_months(:P_KeyDate,-1,'FAIL') AS LastMonthDate,
substring(dats_add_months(:P_KeyDate,-1,'FAIL'),5,2 ) AS LastMonth,
substring(dats_add_months(:P_KeyDate,-12,'FAIL'),1,4 ) AS LastYear,
dats_add_months(:P_KeyDate,-12,'FAIL') AS LastYearDate,
cast( substring( cast( I_CaseAttributes.CreationDateTime as sstring ),1,8 ) as abap.dats ) AS CaseCreationDate,
cast( substring( cast( I_CaseAttributes.CloseDateTime as sstring ),1,8 ) as abap.dats ) AS CaseClosingDate,
substring( cast( I_CaseAttributes.CloseDateTime as sstring ),1,4 ) AS CaseClosingYear,
substring( cast( I_CaseAttributes.CloseDateTime as sstring ),5,2 ) AS CaseClosingMonth
FROM I_DisputeCase
INNER JOIN I_CaseAttributes ON /* join condition not captured in parsed metadata */
;