P_FirstStockOutValues

DDL: P_FIRSTSTOCKOUTVALUES SQL: PFIRSTSTKVAL Type: view CONSUMPTION

First Stock Out Values

P_FirstStockOutValues is a Consumption CDS View that provides data about "First Stock Out Values" in SAP S/4HANA. It reads from 1 data source (PPH_DDL_DDMRP_PROJCTD_STCK_AOR) and exposes 20 fields with key fields Material, Plant, MRPArea.

Data Sources (1)

SourceAliasJoin Type
PPH_DDL_DDMRP_PROJCTD_STCK_AOR PPH_DDL_DDMRP_PROJCTD_STCK_AOR from

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName PFIRSTSTKVAL view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #CHECK view
VDM.viewType #CONSUMPTION view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view
EndUserText.label First Stock Out Values view

Fields (20)

KeyFieldSource TableSource FieldDescription
KEY Material _pstk matnr Vehicle Model
KEY Plant _pstk werks Receiving Plant
KEY MRPArea _pstk berid Single-Character Flag
MaterialSafetyStockQty _pstk sft_stk
DecoupledLeadTime _pstk decoupled_lead_time_date
StockOutAlertIsPresent first_below_zero
below_zero_dateendasFirstStkOutDate
dec132endasFirstStkOutProjtdSFTPct
ThresholdAlertIsPresent first_below_on_hand_alrt_thld
below_thld_dateendasFirstBelowThldDate
dec132endasFirstBelowThldProjtdSFTPct
SafetyStockAlertIsPresent first_below_safety
below_sft_dateendasFirstBelowSFTDate
dec132endasFirstBelowSFTProjtdSFTPct
NetFlowPositionQuantity
OpenSupplyQuantity _pstk open_supply
open_demandasOpenDemandQuantity
spike_demandasBufferSpikeThreshold
OnHandStockQuantity
spike_demandasQualifiedDemandQuantity

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_FirstStockOutValues.
-- 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: PFIRSTSTKVAL

CREATE VIEW P_FirstStockOutValues AS
SELECT
  _pstk.matnr AS Material,
  _pstk.werks AS Plant,
  _pstk.berid AS MRPArea,
  _pstk.sft_stk AS MaterialSafetyStockQty,
  _pstk.decoupled_lead_time_date AS DecoupledLeadTime,
  first_below_zero AS StockOutAlertIsPresent,
  case when first_below_zero = 'X' then _pstk.below_zero_date end as FirstStkOutDate AS below_zero_dateendasFirstStkOutDate,
  case when first_below_zero = 'X' and _pstk.below_zero_sft_stk != 0.000 then cast(((cast(1 as abap.dec(13,4)) - (DIVISION((_pstk.below_zero_sft_stk - _pstk.below_zero_proj_stk), _pstk.below_zero_sft_stk, 4))) * 100) as abap.dec(13,2)) end as FirstStkOutProjtdSFTPct AS dec132endasFirstStkOutProjtdSFTPct,
  first_below_on_hand_alrt_thld AS ThresholdAlertIsPresent,
  case when first_below_on_hand_alrt_thld = 'X' then _pstk.below_thld_date end as FirstBelowThldDate AS below_thld_dateendasFirstBelowThldDate,
  case when first_below_on_hand_alrt_thld = 'X' and _pstk.below_thld_sft_stk != 0.000 then cast(((cast(1 as abap.dec(13,4)) - (DIVISION((_pstk.below_thld_sft_stk - _pstk.below_thld_proj_stk), _pstk.below_thld_sft_stk, 4))) * 100) as abap.dec(13,2)) end as FirstBelowThldProjtdSFTPct AS dec132endasFirstBelowThldProjtdSFTPct,
  first_below_safety AS SafetyStockAlertIsPresent,
  case when first_below_safety = 'X' then _pstk.below_sft_date end as FirstBelowSFTDate AS below_sft_dateendasFirstBelowSFTDate,
  case when first_below_safety = 'X' and _pstk.below_sft_sft_stk != 0.000 then cast(((cast(1 as abap.dec(13,4)) - (DIVISION((_pstk.below_sft_sft_stk - _pstk.below_sft_proj_stk), _pstk.below_sft_sft_stk, 4))) * 100) as abap.dec(13,2)) end as FirstBelowSFTProjtdSFTPct AS dec132endasFirstBelowSFTProjtdSFTPct,
  coalesce( ((_pstk.on_hand_stock + _pstk.open_supply)- (_pstk.open_demand + _pstk.spike_demand)), 0 ) AS NetFlowPositionQuantity,
  _pstk.open_supply AS OpenSupplyQuantity,
  coalesce(_pstk.on_hand_stock,0) AS OnHandStockQuantity
FROM PPH_DDL_DDMRP_PROJCTD_STCK_AOR
;