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_WorkCenterCapPplineOp.
-- 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: PWCCAPPPLINEOP
CREATE VIEW P_WorkCenterCapPplineOp AS
SELECT
cast(_Order.OrderID as abap.char(12)) AS OrderID,
_Order._OrderMainItem.Material AS Material,
_Order._OrderMainItem.ProductConfiguration AS ProductConfiguration,
workcenter_capacity._Capacity.CapacityBaseQtyUnit AS CapacityBaseQtyUnit,
cast ('1' as capacityrequirementorigin) AS CapacityRequirementOrigin,
cast( _Order.OrderCategory as pph_cfs_sch_ordercategory) AS OrderCategory,
case when _Order.OrderCategory <> '30' then cast( cast( substring( _OrderOperation.OpLtstSchedldExecStrtTme, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 + cast( cast( substring( _OrderOperation.OpLtstSchedldExecStrtTme, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60 + cast( cast( substring( _OrderOperation.OpLtstSchedldExecStrtTme, 5, 2) as abap.numc(2) ) as abap.int4 ) when _Order.OrderCategory = '30' then cast( cast( substring( CapRqmtItmCap.OperationLatestStartTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 + cast( cast( substring( CapRqmtItmCap.OperationLatestStartTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60 + cast( cast( substring( CapRqmtItmCap.OperationLatestStartTime, 5, 2) as abap.numc(2) ) as abap.int4 ) end as OpLtstSchedldExecStrtTme AS int4endasOpLtstSchedldExecStrtTme,
case when _Order.OrderCategory <> '30' then cast( cast( substring( _OrderOperation.LatestScheduledWaitEndTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 + cast( cast( substring( _OrderOperation.LatestScheduledWaitEndTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60 + cast( cast( substring( _OrderOperation.LatestScheduledWaitEndTime, 5, 2) as abap.numc(2) ) as abap.int4 ) when _Order.OrderCategory = '30' then cast( cast( substring( CapRqmtItmCap. OperationLatestEndTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 + cast( cast( substring(CapRqmtItmCap. OperationLatestEndTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60 + cast( cast( substring( CapRqmtItmCap. OperationLatestEndTime, 5, 2) as abap.numc(2) ) as abap.int4 ) end as OpLtstSchedldExecEndTme AS int4endasOpLtstSchedldExecEndTme,
case when CapRqmtItmCap.RemainingCapReqOpSegSetupDurn > 99999999 then fltp_to_dec(99999999.99 as abap.dec( 10,2)) when CapRqmtItmCap.RemainingCapReqOpSegSetupDurn <= 99999999 then fltp_to_dec(CapRqmtItmCap.RemainingCapReqOpSegSetupDurn as abap.dec( 10,2)) end as RemainingCapReqOpSegSetupDurn AS dec102endasRemainingCapReqOpSegSetupDurn,
case when CapRqmtItmCap.OperationIsPhase = '1' and ProcOpDurn.TotRemCapReqOpSegProcgDurn > 99999999 then fltp_to_dec(99999999.99 as abap.dec( 10,2)) when CapRqmtItmCap.OperationIsPhase = '1' and ProcOpDurn.TotRemCapReqOpSegProcgDurn <= 99999999 then fltp_to_dec(ProcOpDurn.TotRemCapReqOpSegProcgDurn as abap.dec( 10,2)) when CapRqmtItmCap.OperationIsPhase <> '1' and ProcOpDurn.TotRemCapReqOpSegProcgDurn > 99999999 then fltp_to_dec(99999999.99 as abap.dec( 10,2)) when CapRqmtItmCap.OperationIsPhase <> '1' and ProcOpDurn.TotRemCapReqOpSegProcgDurn <= 99999999 then fltp_to_dec(CapRqmtItmCap.RemainingCapReqOpSegProcgDurn as abap.dec( 10,2)) end as RemainingCapReqOpSegProcgDurn AS dec102endasRemainingCapReqOpSegProcgDurn,
case when CapRqmtItmCap.RemainingCapReqOpSegTrdwnDurn > 99999999 then fltp_to_dec(99999999.99 as abap.dec( 10,2)) when CapRqmtItmCap.RemainingCapReqOpSegTrdwnDurn <= 99999999 then fltp_to_dec(CapRqmtItmCap.RemainingCapReqOpSegTrdwnDurn as abap.dec( 10,2)) end as RemainingCapReqOpSegTrdwnDurn AS dec102endasRemainingCapReqOpSegTrdwnDurn,
cast('0' as char1) AS OrderFirmingStatusCode,
$session.system_date AS CurrentDate,
case when workcenter._Plant._Address.AddressTimeZone is null or workcenter._Plant._Address.AddressTimeZone is initial then abap_system_timezone($session.client, 'NULL') when workcenter._Plant._Address.AddressTimeZone is not null then workcenter._Plant._Address.AddressTimeZone end as PlantTimeZone AS AddressTimeZoneendasPlantTimeZone,
_Order._OrderMainItem.SalesOrder AS SalesOrder,
cast ( _PlannedOrder.PlannedOrderType as abap.char(3) ) AS OrderType,
CapRqmtItmCap. OperationLatestEndTime AS OperationLatestEndTime,
cast( cast( substring( CapRqmtItmCap.OperationLatestStartTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 + cast( cast( substring( CapRqmtItmCap.OperationLatestStartTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60 + cast( cast( substring( CapRqmtItmCap.OperationLatestStartTime, 5, 2) as abap.numc(2) ) as abap.int4 ) as OpLtstSchedldExecStrtTme AS int4asOpLtstSchedldExecStrtTme,
cast( cast( substring( CapRqmtItmCap. OperationLatestEndTime, 1, 2) as abap.numc(2) ) as abap.int4 ) * 3600 + cast( cast( substring(CapRqmtItmCap. OperationLatestEndTime, 3, 2) as abap.numc(2) ) as abap.int4 ) * 60 + cast( cast( substring( CapRqmtItmCap. OperationLatestEndTime, 5, 2) as abap.numc(2) ) as abap.int4 ) as OpLtstSchedldExecEndTme AS int4asOpLtstSchedldExecEndTme,
'I0001' AS OrderStatusCode,
_Order.Plant AS Plant,
_Order.MRPController AS MRPController,
_Order.OrderPlannedTotalQty AS OrderPlannedTotalQty,
_Order.BaseUnit AS BaseUnit,
_Order.ScheduledBasicStartDate AS ScheduledBasicStartDate,
_Order.ScheduledBasicStartTime AS ScheduledBasicStartTime,
_Order.ScheduledBasicEndDate AS ScheduledBasicEndDate,
_Order.ScheduledBasicEndTime AS ScheduledBasicEndTime,
_OrderOperation.OpLtstSchedldProcgStrtDte AS OpLtstSchedldProcgStrtDte,
_OrderOperation.OpLtstSchedldProcgStrtTme AS OpLtstSchedldProcgStrtTme,
_OrderOperation.OpLtstSchedldTrdwnStrtDte AS OpLtstSchedldTrdwnStrtDte,
_OrderOperation.OpLtstSchedldTrdwnStrtTme AS OpLtstSchedldTrdwnStrtTme,
_OrderOperation.Sequence AS Sequence,
_PlannedOrder.ProductionVersion AS ProductionVersion,
_PlannedOrder.SalesOrderItem AS SalesOrderItem,
CapRqmtItmCap.CapacityInternalID AS CapacityInternalID,
CapRqmtItmCap.Operation AS Operation,
CapRqmtItmCap.CapacityRequirement AS CapacityRequirement,
CapRqmtItmCap.CapacityRequirementItem AS CapacityRequirementItem,
CapRqmtItmCap.PlannedOrder AS PlannedOrder,
CapRqmtItmCap.OrderInternalID AS OrderInternalID,
CapRqmtItmCap.OperationLatestStartDate AS OperationLatestStartDate,
CapRqmtItmCap.OperationLatestStartTime AS OperationLatestStartTime,
CapRqmtItmCap.OperationLatestEndDate AS OperationLatestEndDate,
workcenter.WorkCenter AS WorkCenter,
workcenter.WorkCenterResponsible AS WorkCenterResponsible,
workcenter.WorkCenterCategoryCode AS WorkCenterCategoryCode,
workcenter_capacity.WorkCenterInternalID AS WorkCenterInternalID,
workcenter_capacity.WorkCenterTypeCode AS WorkCenterTypeCode,
workcenter_capacity.CapacityCategoryAllocation AS CapacityCategoryAllocation
FROM I_LogisticsOrder AS _Order
INNER JOIN I_SchedCapacityRqmtItemCap AS CapRqmtItmCap ON /* join condition not captured in parsed metadata */
INNER JOIN I_WorkCenter AS workcenter ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_OrderOperation AS _OrderOperation ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_MfgOrderOpStatus AS _OrderOper ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_ProcCapReqOpDurn AS ProcOpDurn ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_WorkCenterCapacity AS workcenter_capacity ON CapRqmtItmCap.WorkCenterInternalID = workcenter_capacity.WorkCenterInternalID AND CapRqmtItmCap.CapacityInternalID = workcenter_capacity.CapacityInternalID -- association [1..1]
LEFT OUTER JOIN I_PlannedOrder AS _PlannedOrder ON PlannedOrder = _PlannedOrder.PlannedOrder -- association [0..1]
LEFT OUTER JOIN I_CapacityRequirement AS _CapacityRequirement ON CapacityRequirement = _CapacityRequirement.CapacityRequirement -- association [1..1]
-- UNION ALL with additional select branch(es): I_PlannedOrder
;