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_MRPMATERIAL.
-- 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: PMRPMATRL
CREATE VIEW P_MRPMATERIAL AS
SELECT
pph_dbvm.matnr AS Material,
pph_dbvm.werks AS MRPPlant,
pph_dbvm.berid AS MRPArea,
_MRPArea.MRPAreaCategory AS MRPAreaCategory,
_Product.ProductGroup AS MaterialGroup,
_Product.IsMarkedForDeletion AS MaterialIsMarkedForDeletion,
marc.lvorm AS PlntMatlIsMarkedForDeletion,
_Product.CrossPlantStatus AS CrossPlantStatus,
_Product.BaseUnit AS BaseUnit,
_Product.LowLevelCode AS LowLevelCode,
_Product.ProductIsConfigurable AS MaterialIsConfigurable,
marc.mmsta AS MaterialUsabilityProfile,
marc.maabc AS MaterialABCClassification,
marc.ekgrp AS PurchasingGroup,
marc.beskz AS MaterialProcurementCategory,
marc.sbdkz AS DependentRequirementsType,
_Product.ProductType AS MaterialType,
case AS disgrendasMRPGroup,
case when _ProductPlantMRP.MRPResponsible is null or _ProductPlantMRP.MRPResponsible = '' then marc.dispo else _ProductPlantMRP.MRPResponsible end as MRPController AS MRPResponsibleendasMRPController,
marc.rwpro AS RangeOfCvrgPrflCode,
marc.fhori AS SchedulingFloatProfile,
marc.stdpd AS ConfigurableProduct,
marc.bearz AS ProcessingTime,
marc.ruezt AS SetupAndTeardownTime,
marc.tranz AS TransitionTime,
marc.webaz AS GoodsReceiptDuration,
case AS plifzendasMaterialPlannedDeliveryDurn,
marc.dzeit AS MaterialPlannedProductionDurn,
marc.wzeit AS TotalReplenishmentLeadDuration,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.IsSafetyTime,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.IsSafetyTime else marc.shflg end as IsSafetyTime AS shflgendasIsSafetyTime,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.SafetyDuration,'00') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.SafetyDuration else marc.shzet end as MRPSafetyDuration AS shzetendasMRPSafetyDuration,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.PerdPrflForSftyTme,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.PerdPrflForSftyTme else marc.shpro end as PerdPrflForSftyTme AS shproendasPerdPrflForSftyTme,
case when marc.sfty_stk_meth = 'MB' then _TimeDependentStockLevel.ReorderThresholdQuantity when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.ReorderThresholdQuantity ,cast(0 as minbe)) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.ReorderThresholdQuantity else marc.minbe end as ReorderThresholdQuantity AS minbeendasReorderThresholdQuantity,
case when marc.sfty_stk_meth = 'MB' then cast( _TimeDependentStockLevel.ProductSafetyStockLvlQuantity as abap.dec( 13, 3)) when _MRPArea.MRPAreaCategory = '03' then coalesce(cast(_ProductPlantMRP.SafetyStockQuantity as abap.dec( 13, 3)),cast(0 as abap.dec( 13, 3))) when _MRPArea.MRPAreaCategory = '02' then cast(_ProductPlantMRP.SafetyStockQuantity as abap.dec( 13, 3)) else cast(marc.eisbe as abap.dec( 13, 3)) end as SafetyStockQuantity AS dec133endasSafetyStockQuantity,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.LotSizingProcedure,'EX') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.LotSizingProcedure else marc.disls end as LotSizingProcedure AS dislsendasLotSizingProcedure,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.MinimumLotSizeQuantity,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.MinimumLotSizeQuantity else marc.bstmi end as MinimumLotSizeQuantity AS bstmiendasMinimumLotSizeQuantity,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.MaximumLotSizeQuantity,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.MaximumLotSizeQuantity else marc.bstma end as MaximumLotSizeQuantity AS bstmaendasMaximumLotSizeQuantity,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.FixedLotSizeQuantity,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.FixedLotSizeQuantity else marc.bstfe end as FixedLotSizeQuantity AS bstfeendasFixedLotSizeQuantity,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.MaximumStockQuantity,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.MaximumStockQuantity else marc.mabst end as MaterialMaxStockLevelQuantity AS mabstendasMaterialMaxStockLevelQuantity,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.LotSizeIndependentCosts,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.LotSizeIndependentCosts else marc.losfx end as LotSizeIndependentCosts AS losfxendasLotSizeIndependentCosts,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.IsStorageCosts,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.IsStorageCosts else marc.lagpr end as StorageCostsPercentageCode AS lagprendasStorageCostsPercentageCode,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.AssemblyScrapPercent,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.AssemblyScrapPercent else marc.ausss end as AssemblyScrapPercent AS ausssendasAssemblyScrapPercent,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.TaktTime,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.TaktTime else marc.takzt end as TaktTime AS takztendasTaktTime,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.LotSizeRoundingQuantity,0) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.LotSizeRoundingQuantity else marc.bstrf end as PurOrderQtyRoundingQty AS bstrfendasPurOrderQtyRoundingQty,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.RoundingProfile,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.RoundingProfile else marc.rdprf end as RoundingProfile AS rdprfendasRoundingProfile,
marc.strgr AS PlanningStrategyGroup,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.DfltStorageLocationExtProcmt,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.DfltStorageLocationExtProcmt else marc.lgfsb end as DfltStorageLocationExtProcmt AS lgfsbendasDfltStorageLocationExtProcmt,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.MRPPlanningCalendar,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.MRPPlanningCalendar else marc.mrppp end as MRPPlanningCalendar AS mrpppendasMRPPlanningCalendar,
marc.sauft AS RepetitiveManufacturingIsAllwd,
marc.sfepr AS RepetitiveManufacturingProfile,
cast( case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.PlanningTimeFence,'000') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.PlanningTimeFence else marc.fxhor end as fxhor) as PlanningTimeFenceInDays AS fxhorendasfxhorasPlanningTimeFenceInDays,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.MRPType,marc.dismm) when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.MRPType else marc.dismm end as MRPType AS dismmendasMRPType,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(coalesce(coalesce(_ProductPlantMRP.ProcurementSubType,_t460a_def_u.sobsl),_t460a_def_b.sobsl),'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.ProcurementSubType else marc.sobsl end as MaterialProcurementProfile AS sobslendasMaterialProcurementProfile,
marc.fevor AS ProductionSupervisor,
marc.basmg AS MaterialBaseQuantity,
case when _MRPArea.MRPAreaCategory = '03' then coalesce(_ProductPlantMRP.StorageLocation,'') when _MRPArea.MRPAreaCategory = '02' then _ProductPlantMRP.StorageLocation else marc.lgpro end as ProductionInvtryManagedLoc AS lgproendasProductionInvtryManagedLoc,
marc.sfty_stk_meth AS MRPSafetyStockMethod,
_Product.AuthorizationGroup AS AuthorizationGroup,
_ProductPlantMRP._MRPType.MRPProcedure AS MRPProcedure,
marc.mmsta AS PlantSpecificMaterialStatus
FROM pph_dbvm
INNER JOIN marc ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_T460AMAXBANF AS _t460a_def_b ON MRPPlant = _t460a_def_b.werks -- association [0..1]
LEFT OUTER JOIN P_T460AMAX AS _t460a_def_u ON MRPPlant = _t460a_def_u.werks -- association [0..1]
LEFT OUTER JOIN I_MRPArea AS _MRPArea ON MRPArea = _MRPArea.MRPArea -- association [1..1]
LEFT OUTER JOIN I_Product AS _Product ON Material = _Product.Product -- association [1..1]
LEFT OUTER JOIN P_PRODUCTPLANTMRP AS _ProductPlantMRP ON /* condition not available in parsed metadata */ -- association [0..1]
LEFT OUTER JOIN I_TimeDependentStockLevel AS _TimeDependentStockLevel ON Material = _TimeDependentStockLevel.Product AND MRPArea = _TimeDependentStockLevel.MRPArea AND _TimeDependentStockLevel.StockLevelValidityStartDate <= $session.system_date AND _TimeDependentStockLevel.StockLevelValidityEndDate >= $session.system_date -- association [1..1]
;