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_CustomerOrder.
-- 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: P_CUSTORDER
CREATE VIEW P_CustomerOrder AS
SELECT
vbak.mandt AS mandt,
vbak.kunnr AS Customer,
sales.werks AS Plant,
sales.matnr AS Material,
sales.delps AS PositionNumber,
sales.delnr AS OrderNumber,
sales.delet AS ReferenceDocumentScheduleLine,
sales.dat00 AS DeliveryDate,
cast ( 0 - sales.mng01 as abap.quan(13,3)) AS OriginalBaseAmount,
vbap.meins AS QuantityBaseUnitOfMeasure,
P_MaterialInfo.BaseUnitOfMeasure AS BaseUnitOfMeasure,
kna1.name1 AS Name,
knvv.uebto AS IncreaseTolerance,
P_MaterialInfo.Price AS MaterialPrice,
P_MaterialInfo.PriceUnit AS MaterialPriceUnit,
vbap.netpr AS NetPriceAmount,
vbap.waerk AS DocumentCurrency,
P_MaterialInfo.Costprice AS StandardPrice,
P_MaterialInfo.MaterialPriceInCoCodeCurrency AS MaterialPriceInCoCodeCurrency,
$session.system_date AS TodaysDate,
P_MaterialInfo.Umrez AS Umrez,
case when StockCust.customertype = 'KATR1' then kna1.katr1 when StockCust.customertype = 'KATR2' then kna1.katr2 when StockCust.customertype = 'KATR3' then kna1.katr3 when StockCust.customertype = 'KATR4' then kna1.katr4 when StockCust.customertype = 'KATR5' then kna1.katr5 when StockCust.customertype = 'KATR6' then kna1.katr6 when StockCust.customertype = 'KATR7' then kna1.katr7 when StockCust.customertype = 'KATR8' then kna1.katr8 when StockCust.customertype = 'KATR9' then kna1.katr9 when StockCust.customertype = 'KATR10' then kna1.katr10 end as CustomerType AS katr10endasCustomerType,
case when StockCust.tolerancelevel = 'KATR1' then kna1.katr1 when StockCust.customertype = 'KATR2' then kna1.katr2 when StockCust.customertype = 'KATR3' then kna1.katr3 when StockCust.customertype = 'KATR4' then kna1.katr4 when StockCust.customertype = 'KATR5' then kna1.katr5 when StockCust.customertype = 'KATR6' then kna1.katr6 when StockCust.customertype = 'KATR7' then kna1.katr7 when StockCust.customertype = 'KATR8' then kna1.katr8 when StockCust.customertype = 'KATR9' then kna1.katr9 when StockCust.customertype = 'KATR10' then kna1.katr10 end as ToleranceLevel AS katr10endasToleranceLevel
INNER JOIN vbak ON /* join condition not captured in parsed metadata */
INNER JOIN vbap ON /* join condition not captured in parsed metadata */
INNER JOIN kna1 ON /* join condition not captured in parsed metadata */
INNER JOIN knvv ON /* join condition not captured in parsed metadata */
INNER JOIN P_MaterialInfo ON /* join condition not captured in parsed metadata */
INNER JOIN stck_cust_table AS StockCust ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN v_mrp_currency AS currency ON /* join condition not captured in parsed metadata */
;