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_SchedChngOpersLiveCacheMap.
-- 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: PSCHCOPERLC
-- Parameters: P_StartDate : datum, P_EndDate : datum
CREATE VIEW P_SchedChngOpersLiveCacheMap AS
SELECT
cast(CapRqmtItmCap.OrderID as pph_cfs_ordernumber) AS OrderID,
CapRqmtItmCap.CapacityRequirementItem AS CapacityRequirementItem,
CapRqmtItmCap.CapacityRqmtItemCapacity AS CapacityRqmtItemCapacity,
cast(CapRqmtItmCap._Order.OrderCategory as pph_cfs_sch_ordercategory) AS OrderCategory,
CapRqmtItmCap.CapacityRequirement AS CapacityRequirement,
CapRqmtItmCap.OperationIsPhase AS OperationIsPhase,
CapRqmtItmCap.SuperiorOperationInternalID AS SuperiorOperationInternalID,
cast(CapRqmtItmCap.OrderInternalID as abap.char(10)) AS OrderInternalID,
CapRqmtItmCap.OrderOperationInternalID AS OrderOperationInternalID,
case CapRqmtItmCap.Operation when '' then cast('1' as vornr) else cast ( CapRqmtItmCap.Operation as vornr ) end as Operation AS OperationasvornrendasOperation,
case CapRqmtItmCap.OperationIsPhase when '2' then cast(SupCapRqmt.Operation as vornr) else case CapRqmtItmCap.Operation when '' then cast('1' as vornr) else cast ( CapRqmtItmCap.Operation as vornr ) end end as SupOperation AS OperationasvornrendendasSupOperation,
CapRqmtItmCap._WorkCenter.Plant AS Plant,
CapRqmtItmCap.WorkCenterInternalID AS WorkCenterInternalID,
CapRqmtItmCap._WorkCenter.WorkCenter AS WorkCenter,
CapRqmtItmCap.CapacityInternalID AS CapacityInternalID,
case when CapRqmtItmCap._Order.OrderCategory = '30' then CapRqmtItmCap._WorkCenter.WorkCenter else CapRqmtItmCap._Order._OrderMainItem._ProductionVersion.ProductionLine end as ProductionLine AS ProductionLineendasProductionLine,
concat(concat(concat(CapRqmtItmCap.WorkCenterInternalID,'A'),CapRqmtItmCap._WorkCenter.Plant), CapRqmtItmCap.CapacityInternalID) AS ResourceID,
CapRqmtItmCap._Order.ScheduledBasicStartDate AS ScheduledBasicStartDate,
CapRqmtItmCap._Order.ScheduledBasicStartTime AS ScheduledBasicStartTime,
CapRqmtItmCap._Order.ScheduledBasicEndDate AS ScheduledBasicEndDate,
CapRqmtItmCap._Order.ScheduledBasicEndTime AS ScheduledBasicEndTime,
cast('00000000' as psttr) AS PlndOrderPlannedStartDate,
case CapRqmtItmCap._Order.LastChangeDate when '00000000' then cast( dats_tims_to_tstmp( CapRqmtItmCap._Order.CreationDate, CapRqmtItmCap._Order.CreationTime , OrderTimeZone.TimeZoneID, $session.client, 'NULL' ) as abap.char(17)) else cast( dats_tims_to_tstmp( CapRqmtItmCap._Order.LastChangeDate, CapRqmtItmCap._Order.LastChangeTime , OrderTimeZone.TimeZoneID, $session.client, 'NULL' ) as abap.char(17)) end as LastChangeDateTime AS char17endasLastChangeDateTime
FROM I_CapacityRequirementItemCap AS CapRqmtItmCap
LEFT OUTER JOIN I_CapacityRequirementItemCap AS SupCapRqmt ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_SchedProdnOrderTimeZone AS OrderTimeZone ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_BillOfOperationsOpBasic AS Routing ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN P_SchedOrderOperationStatus AS _OrderStatus ON CapRqmtItmCap.OrderObjectInternalID = _OrderStatus.StatusObject -- association [1..1]
-- UNION ALL with additional select branch(es): I_CapacityRequirementItemCap
;