P_CmmdtyHedgeCalcExpsrDealQuan

DDL: P_CMMDTYHEDGECALCEXPSRDEALQUAN SQL: PCMHDGCALEXDLQUA Type: view COMPOSITE

P_CmmdtyHedgeCalcExpsrDealQuan is a Composite CDS View in SAP S/4HANA. It reads from 4 data sources (P_CmmdtyHdgExpsrVersionPeriod, P_CmmdtyHdgTgtQtaExpsrPerdMap, P_CmmdtyHdgTgtQuotaHedgeBook, I_CmmdtyHdgTargetQuotaPosition) and exposes 27 fields with key field CmmdtyHdgConstellationExposure.

Data Sources (4)

SourceAliasJoin Type
P_CmmdtyHdgExpsrVersionPeriod Expsrprd inner
P_CmmdtyHdgTgtQtaExpsrPerdMap P_CmmdtyHdgTgtQtaExpsrPerdMap inner
P_CmmdtyHdgTgtQuotaHedgeBook TargetQuota inner
I_CmmdtyHdgTargetQuotaPosition TQPosition inner

Parameters (7)

NameTypeDefault
P_CmmdtyHdgUtilznPlnExposureID cmm_exposure_id
P_CmmdtyHdgUtilznEvalDate sydatum
P_CmmdtyHdgUtilznIsDesignated xfeld
P_CmmdtyHdgUtilznIsFreeStndg xfeld
P_CmmdtyHdgUtilznIsCnstltnData xfeld
P_CmmdtyHdgUtilznAreOverHedged xfeld
P_CmmdtyHdgPlanExposureVersion cmm_exposure_version

Annotations (10)

NameValueLevelField
AbapCatalog.sqlViewName PCMHDGCALEXDLQUA view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view
ObjectModel.usageType.serviceQuality #B view
ObjectModel.usageType.sizeCategory #S view
ObjectModel.usageType.dataClass #MASTER view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (27)

KeyFieldSource TableSource FieldDescription
KEY CmmdtyHdgConstellationExposure Quantity CmmdtyHdgConstellationExposure
CommodityHedgePlanExposureUUID Quantity CommodityHedgePlanExposureUUID UUID
CmmdtyHdgPlnExpsrCompanyCode Quantity CmmdtyHdgPlnExpsrCompanyCode Company Code
CmmdtyHedgePlanExposureDCSID Quantity CmmdtyHedgePlanExposureDCSID DCS ID
CmmdtyHdgPlanExpsrMktIDCode Quantity CmmdtyHdgPlanExpsrMktIDCode MIC
CmmdtyHdgPlanExposureDirection Quantity CmmdtyHdgPlanExposureDirection Buy or Sell
CmmdtyHdgPlanExposureHedgeBook Quantity CmmdtyHdgPlanExposureHedgeBook Hedge Book
CmmdtyHdgPlnExpsrPerdStartDate Quantity CmmdtyHdgPlnExpsrPerdStartDate Period Start
CmmdtyHdgPlnExpsrPeriodClass Quantity CmmdtyHdgPlnExpsrPeriodClass Period Class
CmmdtyHdgTgtQuotaPositionYear I_CmmdtyHdgTargetQuotaPosition CmmdtyHdgTgtQuotaPositionYear Position Year
CmmdtyHdgTgtQuotaPeriodNumber TgtQtaExpsrmap CmmdtyHdgPlnExpsrDelivPerdType Delivery Period Cat.
CmmdtyHdgPlnExpsrDelivPerdType P_CmmdtyHdgExpsrVersionPeriod CmmdtyHdgPlnExpsrDelivPerdType Delivery Period Cat.
CmmdtyHdgPlnExpsrDelivPerdYear P_CmmdtyHdgExpsrVersionPeriod CmmdtyHdgPlnExpsrDelivPerdYear Exposure Deliv. Year
CmmdtyHdgPlnExpsrDelivPerdText
CmmdtyHedgePlnExposureQuantity Quantity CmmdtyHedgePlnExposureQuantity Qty
CmmdtyHdgPlnExpsrQuantityUnit Quantity CmmdtyHdgPlnExpsrQuantityUnit Unit of Measure
CmmdtyHdgUtilznHedgedAbsltVal
fltpendasCmmdtyHedgeUtilznHedgedPercent
CmmdtyHdgUtilznHedgedAcctgVal
fltpendasCmmdtyHdgUtilznHedgedAcctgPct
CmmdtyHdgUtilznHdgFreeStndgVal
fltpendasCmmdtyHdgUtilznHdgFreeStndgPct
fltpendasCmmdtyHdgUtilznOverHedgedValue
fltpendasCmmdtyHedgeUtilznOverHedgedPct
fltpendasCmmdtyHdgUtilznTgtQtaMgmtValue
fltpendasCmmdtyHdgUtilznTgtQtaAcctgVal
CmmdtyHdgUtilznTgtQtaAcctgPct I_CmmdtyHdgTargetQuotaPosition CmmdtyHdgAcctgUprLmtInPercent

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_CmmdtyHedgeCalcExpsrDealQuan.
-- 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: PCMHDGCALEXDLQUA
-- Parameters: P_CmmdtyHdgUtilznPlnExposureID : cmm_exposure_id, P_CmmdtyHdgUtilznEvalDate : sydatum, P_CmmdtyHdgUtilznIsDesignated : xfeld, P_CmmdtyHdgUtilznIsFreeStndg : xfeld, P_CmmdtyHdgUtilznIsCnstltnData : xfeld, P_CmmdtyHdgUtilznAreOverHedged : xfeld, P_CmmdtyHdgPlanExposureVersion : cmm_exposure_version

CREATE VIEW P_CmmdtyHedgeCalcExpsrDealQuan AS
SELECT
  Quantity.CmmdtyHdgConstellationExposure AS CmmdtyHdgConstellationExposure,
  Quantity.CommodityHedgePlanExposureUUID AS CommodityHedgePlanExposureUUID,
  Quantity.CmmdtyHdgPlnExpsrCompanyCode AS CmmdtyHdgPlnExpsrCompanyCode,
  Quantity.CmmdtyHedgePlanExposureDCSID AS CmmdtyHedgePlanExposureDCSID,
  Quantity.CmmdtyHdgPlanExpsrMktIDCode AS CmmdtyHdgPlanExpsrMktIDCode,
  Quantity.CmmdtyHdgPlanExposureDirection AS CmmdtyHdgPlanExposureDirection,
  Quantity.CmmdtyHdgPlanExposureHedgeBook AS CmmdtyHdgPlanExposureHedgeBook,
  Quantity.CmmdtyHdgPlnExpsrPerdStartDate AS CmmdtyHdgPlnExpsrPerdStartDate,
  Quantity.CmmdtyHdgPlnExpsrPeriodClass AS CmmdtyHdgPlnExpsrPeriodClass,
  TQPosition.CmmdtyHdgTgtQuotaPositionYear AS CmmdtyHdgTgtQuotaPositionYear,
  TgtQtaExpsrmap.CmmdtyHdgPlnExpsrDelivPerdType AS CmmdtyHdgTgtQuotaPeriodNumber,
  Expsrprd.CmmdtyHdgPlnExpsrDelivPerdType AS CmmdtyHdgPlnExpsrDelivPerdType,
  Expsrprd.CmmdtyHdgPlnExpsrDelivPerdYear AS CmmdtyHdgPlnExpsrDelivPerdYear,
  concat ( concat( Expsrprd.CmmdtyHdgPlnExpsrDelivPerdType, '/' ), Expsrprd.CmmdtyHdgPlnExpsrDelivPerdYear ) AS CmmdtyHdgPlnExpsrDelivPerdText,
  Quantity.CmmdtyHedgePlnExposureQuantity AS CmmdtyHedgePlnExposureQuantity,
  Quantity.CmmdtyHdgPlnExpsrQuantityUnit AS CmmdtyHdgPlnExpsrQuantityUnit,
  sum(Quantity.CmmdtyHdgDealQtyInExposureUoM) AS CmmdtyHdgUtilznHedgedAbsltVal,
  case when Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 then ( sum(Quantity.CmmdtyHdgDealQtyInExposureUoM) * cast(100 as abap.fltp)) / Quantity.CmmdtyHedgePlnExposureQuantity else cast(0 as abap.fltp) end as CmmdtyHedgeUtilznHedgedPercent AS fltpendasCmmdtyHedgeUtilznHedgedPercent,
  sum(Quantity.CmmdtyHdgDsgntdDealQuantity) AS CmmdtyHdgUtilznHedgedAcctgVal,
  case when Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 then ( sum(Quantity.CmmdtyHdgDsgntdDealQuantity) * cast(100 as abap.fltp)) / Quantity.CmmdtyHedgePlnExposureQuantity else cast(0 as abap.fltp) end as CmmdtyHdgUtilznHedgedAcctgPct AS fltpendasCmmdtyHdgUtilznHedgedAcctgPct,
  sum(Quantity.CmmdtyHdgFreeStndgQuantity) AS CmmdtyHdgUtilznHdgFreeStndgVal,
  case when Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 then ( sum(Quantity.CmmdtyHdgFreeStndgQuantity) * cast(100 as abap.fltp)) / Quantity.CmmdtyHedgePlnExposureQuantity else cast(0 as abap.fltp) end as CmmdtyHdgUtilznHdgFreeStndgPct AS fltpendasCmmdtyHdgUtilznHdgFreeStndgPct,
  case when TargetQuota.CmmdtyHdgTgtQuotaIsFullyHedged = 'X' and Quantity.CmmdtyHdgIsPrcgInDelivPeriod = 'X' and TgtQtaExpsrmap.CmmdtyHdgTgtQtaPerdStartValue <= substring($parameters.P_CmmdtyHdgUtilznEvalDate,5,4) then (sum(Quantity.CmmdtyHdgDealQtyInExposureUoM) - ( Quantity.CmmdtyHedgePlnExposureQuantity ) ) else (sum(Quantity.CmmdtyHdgDealQtyInExposureUoM) - ( Quantity.CmmdtyHedgePlnExposureQuantity * ( TQPosition.CmmdtyHdgTgtQtaUprLmtInPercent / cast(100 as abap.fltp) ) ) ) end as CmmdtyHdgUtilznOverHedgedValue AS fltpendasCmmdtyHdgUtilznOverHedgedValue,
  case when ( Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 ) and TargetQuota.CmmdtyHdgTgtQuotaIsFullyHedged = ' ' then ((sum(Quantity.CmmdtyHdgDealQtyInExposureUoM) - ( Quantity.CmmdtyHedgePlnExposureQuantity * ( TQPosition.CmmdtyHdgTgtQtaUprLmtInPercent / cast(100 as abap.fltp) ) ) ) * cast(100 as abap.fltp)) / Quantity.CmmdtyHedgePlnExposureQuantity when ( Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 ) and ( TargetQuota.CmmdtyHdgTgtQuotaIsFullyHedged = 'X' and Quantity.CmmdtyHdgIsPrcgInDelivPeriod = 'X' and TgtQtaExpsrmap.CmmdtyHdgTgtQtaPerdStartValue <= substring($parameters.P_CmmdtyHdgUtilznEvalDate,5,4) ) then ((sum(Quantity.CmmdtyHdgDealQtyInExposureUoM) - ( Quantity.CmmdtyHedgePlnExposureQuantity ) ) * cast(100 as abap.fltp)) / Quantity.CmmdtyHedgePlnExposureQuantity else cast(0 as abap.fltp) end as CmmdtyHedgeUtilznOverHedgedPct AS fltpendasCmmdtyHedgeUtilznOverHedgedPct,
  case when ( Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 ) and TargetQuota.CmmdtyHdgTgtQuotaIsFullyHedged = ' ' then ( TQPosition.CmmdtyHdgTgtQtaUprLmtInPercent / cast(100 as abap.fltp ) )* Quantity.CmmdtyHedgePlnExposureQuantity when ( Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 ) and ( TargetQuota.CmmdtyHdgTgtQuotaIsFullyHedged = 'X' and Quantity.CmmdtyHdgIsPrcgInDelivPeriod = 'X' and TgtQtaExpsrmap.CmmdtyHdgTgtQtaPerdStartValue <= substring($parameters.P_CmmdtyHdgUtilznEvalDate,5,4) ) then Quantity.CmmdtyHedgePlnExposureQuantity else cast(0 as abap.fltp) end as CmmdtyHdgUtilznTgtQtaMgmtValue AS fltpendasCmmdtyHdgUtilznTgtQtaMgmtValue,
  case when Quantity.CmmdtyHedgePlnExposureQuantity is not null and Quantity.CmmdtyHedgePlnExposureQuantity is not initial and Quantity.CmmdtyHedgePlnExposureQuantity <> 0 then ( TQPosition.CmmdtyHdgAcctgUprLmtInPercent / cast(100 as abap.fltp ) ) * Quantity.CmmdtyHedgePlnExposureQuantity else cast(0 as abap.fltp) end as CmmdtyHdgUtilznTgtQtaAcctgVal AS fltpendasCmmdtyHdgUtilznTgtQtaAcctgVal,
  TQPosition.CmmdtyHdgAcctgUprLmtInPercent AS CmmdtyHdgUtilznTgtQtaAcctgPct
INNER JOIN P_CmmdtyHdgExpsrVersionPeriod AS Expsrprd ON /* join condition not captured in parsed metadata */
INNER JOIN P_CmmdtyHdgTgtQtaExpsrPerdMap ON /* join condition not captured in parsed metadata */
INNER JOIN P_CmmdtyHdgTgtQuotaHedgeBook AS TargetQuota ON /* join condition not captured in parsed metadata */
INNER JOIN I_CmmdtyHdgTargetQuotaPosition AS TQPosition ON /* join condition not captured in parsed metadata */
;