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_CmmdtyMtmValue_Final.
-- 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: PCMMDTYMTMVALUEF
-- Parameters: P_consumption_type : cmm_vlogp_consumptiontype, P_valuation_date0 : cmm_eval_keydate, P_valuation_date1 : cmm_eval_keydate, P_FX_valuation_date : cmm_eval_keydate, P_snapshot_date0 : cmm_dend_cutdate, P_snapshot_date1 : cmm_dend_cutdate
CREATE VIEW P_CmmdtyMtmValue_Final AS
SELECT
mtmvalue.PricingKey AS PricingKey,
mtmvalue.Version AS Version,
mtmvalue.PricingDocumentItem AS PricingDocumentItem,
mtmvalue.ConditionType AS ConditionType,
mtmvalue.SubConditionType AS SubConditionType,
mtmvalue.VersStockRecordUUID AS VersStockRecordUUID,
mtmvalue.ValuationDate AS ValuationDate,
mtmvalue.EndOfDaySnapshotDate AS EndOfDaySnapshotDate,
mtmvalue.EndOfDayBusinessEntityKey AS EndOfDayBusinessEntityKey,
mtmvalue.MTMDataSourceType AS MTMDataSourceType,
mtmvalue.MaximumVersion AS MaximumVersion,
mtmvalue.PreviousVersion AS PreviousVersion,
mtmvalue.PreviousSubConditionType AS PrevVersionSubConditionType,
mtmvalue.EndOfDayTimestampFrom AS EndOfDaySnapshotDateTimeFrom,
mtmvalue.EndOfDayTimestampTo AS EndOfDaySnapshotDateTimeTo,
mtmvalue.DataSelectionType AS DataSelectionType,
mtmvalue.SalesOrganization AS SalesOrganization,
mtmvalue.DistributionChannel AS DistributionChannel,
mtmvalue.Division AS Division,
mtmvalue.Creditor AS Creditor,
mtmvalue.SoldToParty AS SoldToParty,
mtmvalue.Material AS Material,
mtmvalue.PhysicalCommodity AS PhysicalCommodity,
mtmvalue.Plant AS Plant,
mtmvalue.StorageLocation AS StorageLocation,
mtmvalue.Batch AS Batch,
cast (mtmvalue.GoodsMovementType as bwart) AS GoodsMovementType,
mtmvalue.IncotermsTransferLocation AS IncotermsTransferLocation,
mtmvalue.ConditionApplication AS ConditionApplication,
cast (mtmvalue.ValidityStartDate as cds_lastchanged_date) AS ValidityStartDate,
mtmvalue.ValidityStartDateTime AS ValidityStartDateTime,
cast (mtmvalue.SourceDocument as cds_source_document) AS SourceDocument,
cast (mtmvalue.SourceDocumentItem as cds_source_document_item) AS SourceDocumentItem,
cast (mtmvalue.SourceDocumentBusObjType as cds_source_document_bor_type) AS SourceDocumentBusObjType,
mtmvalue.OriginReferenceDocument AS OriginReferenceDocument,
mtmvalue.OriginReferenceDocBusObjType AS OriginReferenceDocBusObjType,
mtmvalue.OriginReferenceDocumentItem AS OriginReferenceDocumentItem,
mtmvalue.ReferenceDocument AS ReferenceDocument,
mtmvalue.ReferenceDocumentItem AS ReferenceDocumentItem,
mtmvalue.ReferenceDocBusObjType AS ReferenceDocBusObjType,
mtmvalue.DeliveryDate AS DeliveryDate,
mtmvalue.DeliveryYear AS DeliveryYear,
mtmvalue.DeliveryMonth AS DeliveryMonth,
cast (mtmvalue.ExpectedPaymentDate as cmm_mtm_date_pymnt) AS ExpectedPaymentDate,
cast (mtmvalue.fxvaluationdate as cmm_reporting_fxsnapdate) AS ExchRateEvaluationDate,
cast (mtmvalue.fxvaluationdatedoctoststc as cds_doc_to_stat_fx_snap_date) AS DocToStstcCrcyExchRateEvalDate,
cast( mtmvalue.StatisticsCurrency as cds_statistics_currency) AS StatisticsCurrency,
mtmvalue.DocumentCurrency AS DocumentCurrency,
mtmvalue.QuotationPeriodReferenceDate AS QuotationPeriodReferenceDate,
mtmvalue.ProfitCenter AS ProfitCenter,
mtmvalue.BusinessArea AS BusinessArea,
mtmvalue.PurchasingOrganization AS PurchasingOrganization,
mtmvalue.MaterialGroup AS MaterialGroup,
mtmvalue.IsIntercompanyTransfer AS IsIntercompanyTransfer,
cast( cast( mtmvalue.ConditionTermRate as abap.curr(31,8)) as cmm_reporting_price_crur ) AS ConditionTermRate,
cast (mtmvalue.MarketToDocExchrate as cmm_reporting_exchrate_market) AS MarketToDocExchRate,
cast (mtmvalue.MarketToDocFrozenExchrate as cds_marktodoc_frozen_exchrate) AS MarketToDocFrozenExchRate,
cast (mtmvalue.ConditionTermRateCurrency as cds_pricecurrency) AS ConditionTermRateCurrency,
cast (mtmvalue.ConditionTermRateQuantity as cmm_reporting_priceunit) AS ConditionTermRateQuantity,
cast (mtmvalue.ConditionTermRateQuantityUnit as cds_priceuom) AS ConditionTermRateQuantityUnit,
cast ( mtmvalue.ConditionTermValueInDocCrcy as cds_value_in_doccur) AS ConditionTermValueInDocCrcy,
cast ( cast( mtmvalue.ConditionTermValueInStstcCrcy as abap.curr(31,11) ) as cds_value_in_statcur_curr) AS ConditionTermValueInStstcCrcy,
cast( mtmvalue.DocToStatisticalExchRate as cmm_reporting_exchrate_func) AS DocToStatisticalExchRate,
mtmvalue.ConditionTermValueCurrency AS ConditionTermValueCurrency,
cast (mtmvalue.BasisType as tbac_basis_type) AS BasisType,
cast (mtmvalue.DerivativeContrSpecification as tba_dcsid) AS DerivativeContrSpecification,
cast (mtmvalue.MarketIdentifierCode as tba_mic) AS MarketIdentifierCode,
cast (mtmvalue.MaturityKeyDate as tba_keydate) AS MaturityKeyDate,
cast (mtmvalue.commoditycontractmaturitycode as tba_contract_code) AS DerivativeContractMaturityCode,
mtmvalue.QuotationPriceType AS QuotationPriceType,
cast (mtmvalue.MarketCurrency as cds_marketprice_currency) AS MarketPriceCurrency,
cast (mtmvalue.OldestQuotationDate as cds_oldestquotdate) AS OldestQuotationDate,
cast (substring(cast (mtmvalue.SystemMessageNumber as abap.char(4)), 2, 3) as cds_systemmessagenumber) AS SystemMessageNumber,
cast( HasError as cmm_error_occured) AS HasError,
cast (mtmvalue.CommodityQuantityInTermUnit as cds_cmmdtyqty_in_termuom) AS CommodityQuantityInTermUnit,
mtmvalue.MTMConditionGroupCategory AS MTMConditionGroupCategory,
mtmvalue.MTMConditionGroup AS MTMConditionGroup,
mtmvalue.MTMCalculationGroup AS MTMCalculationGroup,
mtmvalue.MTMAdjustmentType AS MTMAdjustmentType,
mtmvalue.MTMCalcGrpMarketPriceCondition AS MTMCalcGrpMarketPriceCondition,
mtmvalue.ConditionTermRateIsFixed AS ConditionTermRateIsFixed,
mtmvalue.ConditionTermExchRateIsFixed AS ConditionTermExchRateIsFixed,
cast (mtmvalue.ConditionTermRateFixation as cds_fixation_id) AS ConditionTermRateFixation,
mtmvalue.PricingStatus AS PricingStatus,
mtmvalue.CndnTermRateFixationDate AS CndnTermRateFixationDate,
mtmvalue.CndnTermRateFixationTime AS CndnTermRateFixationTime,
mtmvalue.CndnTermExchRateFixationDate AS CndnTermExchRateFixationDate,
mtmvalue.CndnTermExchRateFixationTime AS CndnTermExchRateFixationTime,
mtmvalue.FixedExchRateDate AS FixedExchRateDate,
cast (mtmvalue.ExchRateMaturityDate as cmm_fx_maturity_date) AS ExchRateMaturityDate,
mtmvalue.BsMktRefDrvtvContrMaturityCode AS BsMktRefDrvtvContrMaturityCode,
mtmvalue.BasisMarketRefRate AS BasisMarketRefRate,
mtmvalue.BasisMarketRefRateCurrency AS BasisMarketRefRateCurrency,
mtmvalue.BasisMarketRefKeyDate AS BasisMarketRefKeyDate,
mtmvalue.BasisMarketRefAdjustmentSpread AS BasisMarketRefAdjustmentSpread,
mtmvalue.ConditionTermFactor AS ConditionTermFactor,
mtmvalue.PrevVersionCommodityQuantity AS PrevVersionCommodityQuantity,
mtmvalue.PreviousVersionQuantitySign AS PreviousVersionQuantitySign,
mtmvalue.PrevVersCndnTermRateCurrency AS PrevVersCndnTermRateCurrency,
mtmvalue.PrevVersionConditionTermValue AS PrevVersionConditionTermValue,
mtmvalue.CmmdtyPriceExpsrMassUnit AS CmmdtyPriceExpsrMassUnit,
mtmvalue.CmmdtyPriceExpsrQtyInMassUnit AS CmmdtyPriceExpsrQtyInMassUnit,
mtmvalue.CmmdtyPriceExpsrVolumeUnit AS CmmdtyPriceExpsrVolumeUnit,
mtmvalue.CmmdtyPriceExpsrQtyInVolUnit AS CmmdtyPriceExpsrQtyInVolUnit,
mtmvalue.PricedContractQuantity AS PricedContractQuantity,
mtmvalue.UnpricedContractQuantity AS UnpricedContractQuantity,
mtmvalue.TodayPricedQuantity AS TodayPricedQuantity,
mtmvalue.PricedContractQuantityInMass AS PricedContractQuantityInMass,
mtmvalue.UnpricedContractQuantityInMass AS UnpricedContractQuantityInMass,
mtmvalue.TodayPricedQuantityInMass AS TodayPricedQuantityInMass,
mtmvalue.PricedContractQuantityInVol AS PricedContractQuantityInVol,
mtmvalue.UnpricedContractQuantityInVol AS UnpricedContractQuantityInVol,
mtmvalue.TodayPricedQuantityInVol AS TodayPricedQuantityInVol,
mtmvalue.ContrPriceExposureIsExecuted AS ContrPriceExposureIsExecuted,
mtmvalue.PricedDays AS PricedDays,
mtmvalue.UnpricedDays AS UnpricedDays,
mtmvalue.TodayDays AS TodayDays,
mtmvalue.PriceSettingMethod AS PriceSettingMethod,
mtmvalue.PriceSettingMethodStatus AS PriceSettingMethodStatus,
mtmvalue.ValidToDateTime AS ValidToDateTime,
mtmvalue.PricingProcedure AS PricingProcedure,
mtmvalue.PricingConditionTerm AS PricingConditionTerm,
mtmvalue.CmmdtyRootDocExternalNumber AS CmmdtyRootDocExternalNumber,
mtmvalue.CmmdtyDocumentExternalNumber AS CmmdtyDocumentExternalNumber
FROM P_CmmdtyMtmDodValue
;