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 nsdm_e_mard.
-- 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: NSDM_V_MARD
CREATE VIEW nsdm_e_mard AS
SELECT
t.mandt AS mandt,
t.matnr AS matnr,
t.werks AS werks,
t.lgort AS lgort,
t.pstat AS pstat,
t.lvorm AS lvorm,
t.sperr AS sperr,
case when m.labst is null then 0 else m.labst end AS labst,
case when m.umlme is null then 0 else m.umlme end AS umlme,
case when m.insme is null then 0 else m.insme end AS insme,
case when m.einme is null then 0 else m.einme end AS einme,
case when m.speme is null then 0 else m.speme end AS speme,
case when m.retme is null then 0 else m.retme end AS retme,
case when m.vmlab is null then 0 else m.vmlab end AS vmlab,
case when m.vmuml is null then 0 else m.vmuml end AS vmuml,
case when m.vmins is null then 0 else m.vmins end AS vmins,
case when m.vmein is null then 0 else m.vmein end AS vmein,
case when m.vmspe is null then 0 else m.vmspe end AS vmspe,
case when m.vmret is null then 0 else m.vmret end AS vmret,
t.kzill AS kzill,
t.kzilq AS kzilq,
t.kzile AS kzile,
t.kzils AS kzils,
t.kzvll AS kzvll,
t.kzvlq AS kzvlq,
t.kzvle AS kzvle,
t.kzvls AS kzvls,
t.diskz AS diskz,
t.lsobs AS lsobs,
t.lminb AS lminb,
t.lbstf AS lbstf,
t.herkl AS herkl,
t.exppg AS exppg,
t.exver AS exver,
t.lgpbe AS lgpbe,
case when m.klabs is null then 0 else m.klabs end AS klabs,
case when m.kinsm is null then 0 else m.kinsm end AS kinsm,
case when m.keinm is null then 0 else m.keinm end AS keinm,
case when m.kspem is null then 0 else m.kspem end AS kspem,
t.dlinl AS dlinl,
t.prctl AS prctl,
t.ersda AS ersda,
case when m.vklab is null then 0 else m.vklab end AS vklab,
case when m.vkuml is null then 0 else m.vkuml end AS vkuml,
t.lwmkb AS lwmkb,
t.bskrf AS bskrf,
'X' AS mdrue,
t.mdjin AS mdjin,
case when m./cwm/labst is null then 0 else m./cwm/labst end AS /cwm/labst,
case when m./cwm/insme is null then 0 else m./cwm/insme end AS /cwm/insme,
case when m./cwm/einme is null then 0 else m./cwm/einme end AS /cwm/einme,
case when m./cwm/speme is null then 0 else m./cwm/speme end AS /cwm/speme,
case when m./cwm/retme is null then 0 else m./cwm/retme end AS /cwm/retme,
case when m./cwm/umlme is null then 0 else m./cwm/umlme end AS /cwm/umlme,
case when m./cwm/klabs is null then 0 else m./cwm/klabs end AS /cwm/klabs,
case when m./cwm/kinsm is null then 0 else m./cwm/kinsm end AS /cwm/kinsm,
case when m./cwm/keinm is null then 0 else m./cwm/keinm end AS /cwm/keinm,
case when m./cwm/kspem is null then 0 else m./cwm/kspem end AS /cwm/kspem,
case when m./cwm/vmlab is null then 0 else m./cwm/vmlab end AS /cwm/vmlab,
case when m./cwm/vmins is null then 0 else m./cwm/vmins end AS /cwm/vmins,
case when m./cwm/vmein is null then 0 else m./cwm/vmein end AS /cwm/vmein,
case when m./cwm/vmspe is null then 0 else m./cwm/vmspe end AS /cwm/vmspe,
case when m./cwm/vmret is null then 0 else m./cwm/vmret end AS /cwm/vmret,
case when m./cwm/vmuml is null then 0 else m./cwm/vmuml end AS /cwm/vmuml
FROM mard AS t
LEFT OUTER JOIN E_Productstoragelocation AS _ActiveExtension ON matnr = _ActiveExtension.Product AND werks = _ActiveExtension.Plant AND lgort = _ActiveExtension.StorageLocation -- association [0..1]
;