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_EBOC_OrderAndItemCosts5.
-- 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: PEBOCHDITMCST5
-- Parameters: P_OrderID : fis_order_number, P_OrderItem : char4, P_FromFiscalYearPeriod : fis_jahrper, P_ToFiscalYearPeriod : fis_jahrper, P_Ledger : fins_ledger, P_CostComponentStructure : ck_elesmhk, P_CurrencyRole : fac_crcyrole
CREATE VIEW P_EBOC_OrderAndItemCosts5 AS
SELECT
Costs.CostElement AS CostElement,
Costs.CtrlgOriginClassification AS CtrlgOriginClassification,
Costs.ControllingDebitCreditCode AS ControllingDebitCreditCode,
Costs.MfgOrderBusTransactionType AS MfgOrderBusTransactionType,
Costs.OriginCostCenter AS OriginCostCenter,
Costs.OriginCostCtrActivityType AS OriginCostCtrActivityType,
Costs.OriginBusinessProcess AS OriginBusinessProcess,
Costs.OriginOrder AS OriginOrder,
Costs.CostOriginType AS CostOriginType,
Costs.OriginObject AS OriginObject,
Costs.CostOriginGroup AS CostOriginGroup,
Costs.PartnerCostCenter AS PartnerCostCenter,
Costs.PartnerCostCtrActivityType AS PartnerCostCtrActivityType,
Costs.PartnerBusinessProcess AS PartnerBusinessProcess,
Costs.PartnerOrder AS PartnerOrder,
Costs.Partner AS Partner,
Costs.UnitOfMeasure AS UnitOfMeasure,
Costs.IsLotSizeIndependent AS IsLotSizeIndependent,
Costs.SubLedgerAcctLineItemType AS SubLedgerAcctLineItemType,
_LdgrCompCodeCrcy.Currency AS DisplayCurrency,
_EvtBsdOrder.OrderDescription AS OrderDescription,
_EvtBsdOrder.OrderType AS OrderType,
_EvtBsdOrder.OrderCategory AS OrderCategory,
_EvtBsdOrder.ReferenceOrder AS ReferenceOrder,
_EvtBsdOrder.OrderSettlementTriggerType AS OrderSettlementTriggerType,
_EvtBsdOrder.ControllingArea AS ControllingArea,
_EvtBsdOrder.CompanyCode AS CompanyCode,
_EvtBsdOrder.BusinessArea AS BusinessArea,
_EvtBsdOrder.ProfitCenter AS ProfitCenter,
_EvtBsdOrder.ResponsibleCostCenter AS ResponsibleCostCenter,
Costs.Plant AS Plant,
Costs.Material AS Material,
_EvtBsdOrder._RepresentativeOrderItem.SalesOrder AS SalesOrder,
I_ControllingArea.ChartOfAccounts AS ChartOfAccounts,
Costs.CreditActlCostInDspCrcy AS CreditActlCostInDspCrcy,
Costs.DebitActlCostInDspCrcy AS DebitActlCostInDspCrcy,
Costs.ActlCostInDspCrcy AS ActlCostInDspCrcy,
Costs.CrdtActlFxdCostInDspCrcy AS CrdtActlFxdCostInDspCrcy,
Costs.DebitActlFxdCostInDspCrcy AS DebitActlFxdCostInDspCrcy,
Costs.ActlFixedCostInDspCrcy AS ActlFixedCostInDspCrcy,
Costs.CrdtActlVarblCostInDspCrcy AS CrdtActlVarblCostInDspCrcy,
Costs.DebitActlVarblCostInDspCrcy AS DebitActlVarblCostInDspCrcy,
Costs.ActlVarblCostInDspCrcy AS ActlVarblCostInDspCrcy,
Costs.ActualQuantity AS ActualQuantity,
Costs.CreditPlanCostInDspCrcy AS CreditPlanCostInDspCrcy,
Costs.DebitPlanCostInDspCrcy AS DebitPlanCostInDspCrcy,
Costs.PlanCostInDspCrcy AS PlanCostInDspCrcy,
Costs.CrdtPlnFxdCostInDspCrcy AS CrdtPlnFxdCostInDspCrcy,
Costs.DebitPlnFxdCostInDspCrcy AS DebitPlnFxdCostInDspCrcy,
Costs.PlanFixedCostInDspCrcy AS PlanFixedCostInDspCrcy,
Costs.CrdtPlnVarblCostInDspCrcy AS CrdtPlnVarblCostInDspCrcy,
Costs.DebitPlnVarblCostInDspCrcy AS DebitPlnVarblCostInDspCrcy,
Costs.PlanVarblCostInDspCrcy AS PlanVarblCostInDspCrcy,
Costs.PlanQuantity AS PlanQuantity,
Costs.CrdtTargetCostInDspCrcy AS CrdtTargetCostInDspCrcy,
Costs.DebitTargetCostInDspCrcy AS DebitTargetCostInDspCrcy,
Costs.TargetCostInDspCrcy AS TargetCostInDspCrcy,
Costs.TargetQuantity AS TargetQuantity,
Costs.CreditPlanCostInDspCrcy AS CrdtPlanCtrlCostInDspCrcy,
Costs.DebitPlanCostInDspCrcy AS DebitPlanCtrlCostInDspCrcy,
(Costs.CreditPlanCostInDspCrcy + Costs.DebitPlanCostInDspCrcy) AS PlanCtrlCostInDspCrcy,
Costs.CreditActlCostInDspCrcy AS CrdtActlCtrlCostInDspCrcy,
Costs.DebitActlCostInDspCrcy AS DebitActlCtrlCostInDspCrcy,
(Costs.CreditActlCostInDspCrcy + Costs.DebitActlCostInDspCrcy) AS ActlCtrlCostInDspCrcy,
Costs.PlanQuantity AS PlanControlQuantity,
Costs.ActualQuantity AS ActualControlQuantity,
Costs.InptPrVarcAmtInDspCrcy + Costs.InptQtyVarcAmtInDspCrcy + Costs.RsceUsgeVarcAmtInDspCrcy + Costs.ScrapVarcAmtInDspCrcy + Costs.MixedPrVarcAmtInDspCrcy + Costs.OutpPrVarcAmtInDspCrcy + Costs.LotSizeVarcAmtInDspCrcy + Costs.RmngVarcAmtInDspCrcy + Costs.NonSplitVarcAmtInDspCrcy AS CostVarianceInDspCrcy,
Costs.InptPrVarcAmtInDspCrcy AS InptPrVarcAmtInDspCrcy,
Costs.InptQtyVarcAmtInDspCrcy AS InptQtyVarcAmtInDspCrcy,
Costs.RsceUsgeVarcAmtInDspCrcy AS RsceUsgeVarcAmtInDspCrcy,
Costs.ScrapVarcAmtInDspCrcy AS ScrapVarcAmtInDspCrcy,
Costs.MixedPrVarcAmtInDspCrcy AS MixedPrVarcAmtInDspCrcy,
Costs.OutpPrVarcAmtInDspCrcy AS OutpPrVarcAmtInDspCrcy,
Costs.LotSizeVarcAmtInDspCrcy AS LotSizeVarcAmtInDspCrcy,
Costs.RmngVarcAmtInDspCrcy AS RmngVarcAmtInDspCrcy,
Costs.WIPCostInDspCrcy AS WIPCostInDspCrcy,
Costs.UnrlzdCostRsrvAmtInDspCrcy AS UnrlzdCostRsrvAmtInDspCrcy,
Costs.WIPQuantity AS WIPQuantity,
Costs.DebitActlPlnDiffCostInDspCrcy AS DebitActlPlnDiffCostInDspCrcy,
0 AS DebitActlPlanDiffPercent,
Costs.ActlCostInDspCrcy - Costs.PlanCostInDspCrcy AS ActlPlnDiffCostInDspCrcy,
Costs.ActualQuantity - Costs.PlanQuantity AS ActlPlanDiffQuantity,
0 AS DspCrcyActlPlanDiffPct,
0 AS ActlPlanDiffQtyPct,
Costs.DebitActlTgtDiffCostInDspCrcy AS DebitActlTgtDiffCostInDspCrcy,
0 AS DebitActlTgtDiffPercent,
Costs.ActlCostInDspCrcy - Costs.TargetCostInDspCrcy AS ActlTgtDiffCostInDspCrcy,
Costs.ActualQuantity - Costs.TargetQuantity AS ActlTgtDiffQuantity,
0 AS DspCrcyActlTgtDiffPct,
0 AS ActlTgtDiffQtyPct,
cast ( coalesce( _CostComponentGroupAssignment2.CostComponent, _CostComponentGroupAssignment1.CostComponent ) as ck_element) AS CostComponent,
cast ( coalesce( _CostComponentGroupAssignment2.CostComponentGroup, _CostComponentGroupAssignment1.CostComponentGroup ) as ck_el_grup) AS CostComponentGroup,
cast ( coalesce( _CostComponentGroupAssignment2.CostComponentGroupName, _CostComponentGroupAssignment1.CostComponentGroupName ) as fis_ck_txgrp) AS CostComponentGroupName,
:P_CostComponentStructure AS CostComponentStructure,
cast ( coalesce( _CostComponentGroupAssignment4.CostComponent, _CostComponentGroupAssignment3.CostComponent ) as ck_element) AS CostComponentMisc,
cast ( coalesce( _CostComponentGroupAssignment4.CostComponentGroup, _CostComponentGroupAssignment3.CostComponentGroup ) as ck_el_grup) AS CostComponentGroupMisc,
cast ( coalesce( _CostComponentGroupAssignment4.CostComponentGroupName, _CostComponentGroupAssignment3.CostComponentGroupName ) as fis_ck_txgrp) AS CostComponentGroupMiscName
FROM P_EBOC_OrderAndItemCosts4
INNER JOIN I_ProductCostCtrlgOrder AS _EvtBsdOrder ON /* join condition not captured in parsed metadata */
INNER JOIN I_ControllingArea ON /* join condition not captured in parsed metadata */
INNER JOIN I_LedgerCompanyCodeCrcyRolesVH AS _LdgrCompCodeCrcy ON /* join condition not captured in parsed metadata */
;