P_StockLevelMngCalcFields

DDL: P_STOCKLEVELMNGCALCFIELDS SQL: PSTKLVLMNGCF Type: view CONSUMPTION Package: ODATA_PP_DD_STLM

Stock Level Management Calculation Fields

P_StockLevelMngCalcFields is a Consumption CDS View that provides data about "Stock Level Management Calculation Fields" in SAP S/4HANA. It reads from 1 data source (I_StockLevelProposal) and exposes 55 fields with key fields Material, Plant, MRPArea, ProposalStartDate, ProposalVersion. It has 2 associations to related views. Part of development package ODATA_PP_DD_STLM.

Data Sources (1)

SourceAliasJoin Type
I_StockLevelProposal _StockProposed from

Associations (2)

CardinalityTargetAliasCondition
[1..*] P_TimeDependentStockBuffer _StockActual $projection.Material = _StockActual.Material and $projection.Plant = _StockActual.Plant and $projection.MRPArea = _StockActual.MRPArea
[1..1] I_DemandDrivenProduct1 _Product $projection.Material = _Product.Material and $projection.Plant = _Product.Plant and $projection.MRPArea = _Product.MRPArea

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PSTKLVLMNGCF view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.private true view
VDM.viewType #CONSUMPTION view

Fields (55)

KeyFieldSource TableSource FieldDescription
KEY Material I_StockLevelProposal Material Vehicle Model
KEY Plant I_StockLevelProposal Plant Valuation Area
KEY MRPArea I_StockLevelProposal MRPArea MRP Area
KEY ProposalStartDate I_StockLevelProposal ProposalStartDate
KEY ProposalVersion I_StockLevelProposal ProposalVersion
CurrentRedZone _StockActual CurrentRedZone
CurrentLeadTime _StockActual CurrentLeadTime
CurrentLeadTimeFactor _StockActual CurrentLeadTimeFactor
CurrentVariabilityFactor _StockActual CurrentVariabilityFactor
BufferLevelStartDate _StockActual BufferLevelStartDate
CurrentGreenZone _StockActual CurrentGreenZone
CurrentYellowZone _StockActual CurrentYellowZone
CurrentAvgDailyUsage _StockActual CurrentAvgDailyUsage
BillOfMaterialUUID I_StockLevelProposal BillOfMaterialUUID Character Field of Length 12
ProposedBOMUUID _StockActual BillOfMaterialUUID Character Field of Length 12
ProposalEndDate I_StockLevelProposal ProposalEndDate
ProposedAverageDailyUsage I_StockLevelProposal AverageDailyUsage
ProposedGreenZone I_StockLevelProposal ProposedGreenZone
ProposedRedZone I_StockLevelProposal ProposedRedZone
ProposedYellowZone I_StockLevelProposal ProposedYellowZone
ProposedLeadTime I_StockLevelProposal DecoupledLeadTime
ProposedLeadTimeFactor I_StockLevelProposal LeadTimeFactor
ProposedVariabilityFactor I_StockLevelProposal VariabilityFactor
StockLevelProposalID I_StockLevelProposal StockLevelProposalID
StockLevelProposalStatus I_StockLevelProposal StockLevelProposalStatus
AvgDailyUsageUnit I_StockLevelProposal AvgDailyUsageUnit
system_dateassydatumasDifferenceInDays
VariabilityQuantity _StockActual VariabilityQuantity
VariabilityUnit _StockActual VariabilityUnit
ReplenishmentLeadTimeValue _StockActual ReplenishmentLeadTimeValue
CurrentMatlLeadTimeCode _StockActual ReplenishmentLeadTimeCode
CurrentMatlVariabilityCode _StockActual VariabilityCode
ProposedMatlVariabilityCode I_StockLevelProposal VariabilityCode
ProposedMatlVariabilityQty I_StockLevelProposal VariabilityQuantity
ProposedMatlVariabilityUnit I_StockLevelProposal VariabilityUnit
ProposedMatlLeadTimeCode I_StockLevelProposal ReplenishmentLeadTimeCode
ProposedMatlLeadTime I_StockLevelProposal ReplenishmentLeadTimeValue
TotalNoOfDays
CurrentRedZoneendasRedZoneDifference
CurrentGreenZoneendasGreenZoneDifference
00endasAvgDailyUsageDeviationRate
00endasLeadTimeFactorDeviationRate
CurrentLeadTimeendasLeadTimeDifference
00endasLeadTimeDeviationRate
00endasVariabilityFactorDeviationRate
MatlProposedMaxStock
ProposedMaterialBufferProfile
ProposedMatlBufferProfileText
ProcurementTypeDescription _ProcmtText ProcurementTypeDescription
VariabilityDescription _VarText VariabilityDescription
ReplenishmentLeadTimeDesc _ReplnmtText ReplenishmentLeadTimeDesc
IsMinOrderQtyConsidered I_StockLevelProposal IsMinOrderQtyConsidered
HorizonDaysInPast
_StockActual _StockActual
_Product _Product

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_StockLevelMngCalcFields.
-- 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: PSTKLVLMNGCF

CREATE VIEW P_StockLevelMngCalcFields AS
SELECT
  _StockProposed.Material AS Material,
  _StockProposed.Plant AS Plant,
  _StockProposed.MRPArea AS MRPArea,
  _StockProposed.ProposalStartDate AS ProposalStartDate,
  _StockProposed.ProposalVersion AS ProposalVersion,
  _StockActual.CurrentRedZone AS CurrentRedZone,
  _StockActual.CurrentLeadTime AS CurrentLeadTime,
  _StockActual.CurrentLeadTimeFactor AS CurrentLeadTimeFactor,
  _StockActual.CurrentVariabilityFactor AS CurrentVariabilityFactor,
  _StockActual.BufferLevelStartDate AS BufferLevelStartDate,
  _StockActual.CurrentGreenZone AS CurrentGreenZone,
  _StockActual.CurrentYellowZone AS CurrentYellowZone,
  _StockActual.CurrentAvgDailyUsage AS CurrentAvgDailyUsage,
  _StockProposed.BillOfMaterialUUID AS BillOfMaterialUUID,
  _StockActual.BillOfMaterialUUID AS ProposedBOMUUID,
  _StockProposed.ProposalEndDate AS ProposalEndDate,
  _StockProposed.AverageDailyUsage AS ProposedAverageDailyUsage,
  _StockProposed.ProposedGreenZone AS ProposedGreenZone,
  _StockProposed.ProposedRedZone AS ProposedRedZone,
  _StockProposed.ProposedYellowZone AS ProposedYellowZone,
  _StockProposed.DecoupledLeadTime AS ProposedLeadTime,
  _StockProposed.LeadTimeFactor AS ProposedLeadTimeFactor,
  _StockProposed.VariabilityFactor AS ProposedVariabilityFactor,
  _StockProposed.StockLevelProposalID AS StockLevelProposalID,
  _StockProposed.StockLevelProposalStatus AS StockLevelProposalStatus,
  _StockProposed.AvgDailyUsageUnit AS AvgDailyUsageUnit,
  DATS_DAYS_BETWEEN(tstmp_to_dats( _StockProposed.ProposalStatusChangeDate, abap_system_timezone( $session.client,'NULL' ), $session.client, 'NULL' ), cast($session.system_date as sydatum)) as DifferenceInDays AS system_dateassydatumasDifferenceInDays,
  _StockActual.VariabilityQuantity AS VariabilityQuantity,
  _StockActual.VariabilityUnit AS VariabilityUnit,
  _StockActual.ReplenishmentLeadTimeValue AS ReplenishmentLeadTimeValue,
  _StockActual.ReplenishmentLeadTimeCode AS CurrentMatlLeadTimeCode,
  _StockActual.VariabilityCode AS CurrentMatlVariabilityCode,
  _StockProposed.VariabilityCode AS ProposedMatlVariabilityCode,
  _StockProposed.VariabilityQuantity AS ProposedMatlVariabilityQty,
  _StockProposed.VariabilityUnit AS ProposedMatlVariabilityUnit,
  _StockProposed.ReplenishmentLeadTimeCode AS ProposedMatlLeadTimeCode,
  _StockProposed.ReplenishmentLeadTimeValue AS ProposedMatlLeadTime,
  cast( _Product.HorizonDaysInPast as abap.int4) + cast( _Product.HorizonDaysInFuture as abap.int4) AS TotalNoOfDays,
  case when _StockActual.CurrentRedZone is null then _StockProposed.OriglProposedRedZone else _StockProposed.OriglProposedRedZone - _StockActual.CurrentRedZone end as RedZoneDifference AS CurrentRedZoneendasRedZoneDifference,
  case when _StockActual.CurrentGreenZone is null then _StockProposed.OriglProposedGreenZone else _StockProposed.OriglProposedGreenZone - _StockActual.CurrentGreenZone end as GreenZoneDifference AS CurrentGreenZoneendasGreenZoneDifference,
  case when _StockActual.CurrentAvgDailyUsage = 0.000 or _StockActual.CurrentAvgDailyUsage is null then case when _StockProposed.AverageDailyUsage <> 0.000 then fltp_to_dec(99999.99 as abap.dec(12,2)) else 0.00 end else cast((_StockProposed.AverageDailyUsage - _StockActual.CurrentAvgDailyUsage) as abap.fltp)/(cast((_StockActual.CurrentAvgDailyUsage) as abap.fltp))*100.00 end as AvgDailyUsageDeviationRate AS 00endasAvgDailyUsageDeviationRate,
  case when _StockActual.CurrentLeadTimeFactor is null or _StockActual.CurrentLeadTimeFactor = 0.00 then case when _StockProposed.LeadTimeFactor <> 0.00 then fltp_to_dec(99999.99 as abap.dec(12,2)) else 0 end else cast((_StockProposed.LeadTimeFactor - _StockActual.CurrentLeadTimeFactor) as abap.fltp)/(cast((_StockActual.CurrentLeadTimeFactor) as abap.fltp))*100.00 end as LeadTimeFactorDeviationRate AS 00endasLeadTimeFactorDeviationRate,
  case when _StockActual.CurrentLeadTime is null then _StockProposed.DecoupledLeadTime else _StockProposed.DecoupledLeadTime - _StockActual.CurrentLeadTime end as LeadTimeDifference AS CurrentLeadTimeendasLeadTimeDifference,
  case when _StockActual.CurrentLeadTime = 0.00 or _StockActual.CurrentLeadTime is null then case when _StockProposed.DecoupledLeadTime <> 0.00 then fltp_to_dec(99999.99 as abap.dec(12,2)) else 0.00 end else cast((_StockProposed.DecoupledLeadTime - _StockActual.CurrentLeadTime) as abap.fltp)/(cast((_StockActual.CurrentLeadTime) as abap.fltp))*100.00 end as LeadTimeDeviationRate AS 00endasLeadTimeDeviationRate,
  case when _StockActual.VariabilityQuantity = 0.00 or _StockActual.VariabilityQuantity is null then case when _StockProposed.VariabilityQuantity <> 0.00 then fltp_to_dec(99999.99 as abap.dec(12,2)) else 0.00 end else cast((_StockProposed.VariabilityQuantity - _StockActual.VariabilityQuantity ) as abap.fltp)/(cast((_StockActual.VariabilityQuantity ) as abap.fltp))*100.00 end as VariabilityFactorDeviationRate AS 00endasVariabilityFactorDeviationRate,
  _StockProposed.ProposedGreenZone + _StockProposed.ProposedYellowZone + _StockProposed.ProposedRedZone AS MatlProposedMaxStock,
  concat(_StockProposed.ProcurementType,concat('-',concat(concat(_StockProposed.VariabilityCode,'-'),_StockProposed.ReplenishmentLeadTimeCode))) AS ProposedMaterialBufferProfile,
  concat(_StockProposed._ProcmtText.ProcurementTypeDescription,concat('-',concat(concat(_StockProposed._VarText.VariabilityDescription,'-'),_StockProposed._ReplnmtText.ReplenishmentLeadTimeDesc))) AS ProposedMatlBufferProfileText,
  _ProcmtText.ProcurementTypeDescription AS ProcurementTypeDescription,
  _VarText.VariabilityDescription AS VariabilityDescription,
  _ReplnmtText.ReplenishmentLeadTimeDesc AS ReplenishmentLeadTimeDesc,
  _StockProposed.IsMinOrderQtyConsidered AS IsMinOrderQtyConsidered,
  cast(_Product.HorizonDaysInPast as abap.int2) AS HorizonDaysInPast
FROM I_StockLevelProposal AS _StockProposed
LEFT OUTER JOIN P_TimeDependentStockBuffer AS _StockActual ON Material = _StockActual.Material AND Plant = _StockActual.Plant AND MRPArea = _StockActual.MRPArea  -- association [1..*]
LEFT OUTER JOIN I_DemandDrivenProduct1 AS _Product ON Material = _Product.Material AND Plant = _Product.Plant AND MRPArea = _Product.MRPArea  -- association [1..1]
;