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_OrderAndItemCosts.
-- 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: PEBOCHDITMCST
-- 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_OrderAndItemCosts AS
SELECT
CostElement,
cast(CtrlgOriginClassification as fis_kkb_herkz) AS CtrlgOriginClassification,
ControllingDebitCreditCode,
MfgOrderBusTransactionType,
OriginCostCenter,
OriginCostCtrActivityType,
OriginBusinessProcess,
OriginOrder,
CostOriginType,
OriginObject,
CostOriginGroup,
PartnerCostCenter,
PartnerCostCtrActivityType,
PartnerBusinessProcess,
PartnerOrder,
Partner AS PartnerCostObject,
cast(UnitOfMeasure as co_meinh) AS UnitOfMeasure,
Material,
IsLotSizeIndependent,
SubLedgerAcctLineItemType,
cast('%' as msehi) AS RatioUnit,
DisplayCurrency,
ControllingArea,
CompanyCode,
ProfitCenter,
ResponsibleCostCenter,
OrderCategory,
OrderType,
OrderSettlementTriggerType,
Plant,
SalesOrder,
ChartOfAccounts,
$session.system_date AS ValidityDate,
cast(CreditActlCostInDspCrcy as fis_cr_actlcost_in_dspcrcy) AS CreditActlCostInDspCrcy,
cast(DebitActlCostInDspCrcy as fis_dr_actlcost_in_dspcrcy) AS DebitActlCostInDspCrcy,
cast(ActlCostInDspCrcy as fis_actlcost_in_dspcrcy) AS ActlCostInDspCrcy,
cast(CrdtActlFxdCostInDspCrcy as fis_cr_actlfxdcost_in_dspcrcy) AS CrdtActlFxdCostInDspCrcy,
cast(DebitActlFxdCostInDspCrcy as fis_dr_actlfxdcost_in_dspcrcy) AS DebitActlFxdCostInDspCrcy,
cast(ActlFixedCostInDspCrcy as fis_actlfixedcost_in_dspcrcy) AS ActlFixedCostInDspCrcy,
cast(CrdtActlVarblCostInDspCrcy as fis_cr_actlvarblcost_indspcrcy) AS CrdtActlVarblCostInDspCrcy,
cast(DebitActlVarblCostInDspCrcy as fis_dr_actlvarblcost_indspcrcy) AS DebitActlVarblCostInDspCrcy,
cast(ActlVarblCostInDspCrcy as fis_actlvarblcost_in_dspcrcy) AS ActlVarblCostInDspCrcy,
cast(ActualQuantity as fis_actlqty_in_costsrceunit) AS ActualQtyInCostSourceUnit,
cast(CreditPlanCostInDspCrcy as fis_cr_plancost_in_dspcrcy) AS CreditPlanCostInDspCrcy,
cast(DebitPlanCostInDspCrcy as fis_dr_plancost_in_dspcrcy) AS DebitPlanCostInDspCrcy,
cast(PlanCostInDspCrcy as fis_plancost_in_dspcrcy) AS PlanCostInDspCrcy,
cast(CrdtPlnFxdCostInDspCrcy as fis_cr_plnfxdcost_in_dspcrcy) AS CrdtPlnFxdCostInDspCrcy,
cast(DebitPlnFxdCostInDspCrcy as fis_dr_plnfxdcost_in_dspcrcy) AS DebitPlnFxdCostInDspCrcy,
cast(PlanFixedCostInDspCrcy as fis_planfixedcost_in_dspcrcy) AS PlanFixedCostInDspCrcy,
cast(CrdtPlnVarblCostInDspCrcy as fis_cr_plnvarblcost_in_dspcrcy) AS CrdtPlnVarblCostInDspCrcy,
cast(DebitPlnVarblCostInDspCrcy as fis_dr_plnvarblcost_in_dspcrcy) AS DebitPlnVarblCostInDspCrcy,
cast(PlanVarblCostInDspCrcy as fis_planvarblcost_in_dspcrcy) AS PlanVarblCostInDspCrcy,
cast(PlanQuantity as fis_planqty_in_costsrceunit) AS PlanQtyInCostSourceUnit,
cast(CrdtTargetCostInDspCrcy as fis_cr_tgtcost_in_dspcrcy) AS CrdtTargetCostInDspCrcy,
cast(DebitTargetCostInDspCrcy as fis_dr_tgtcost_in_dspcrcy) AS DebitTargetCostInDspCrcy,
cast(TargetCostInDspCrcy as fis_tgtcost_in_dspcrcy) AS TargetCostInDspCrcy,
cast(TargetQuantity as fis_tgtqty_in_costsrceunit) AS TargetQtyInCostSourceUnit,
cast(CreditPlanCostInDspCrcy as fis_cr_planctrlcost_indspcrcy) AS CrdtPlanCtrlCostInDspCrcy,
cast(DebitPlanCostInDspCrcy as fis_dr_planctrlcost_indspcrcy) AS DebitPlanCtrlCostInDspCrcy,
cast(PlanCtrlCostInDspCrcy as fis_planctrlcost_in_dspcrcy) AS PlanCtrlCostInDspCrcy,
cast(PlanControlQuantity as fis_plnctrlqty_incostsrceunit) AS PlanCtrlQtyInCostSourceUnit,
cast(CreditActlCostInDspCrcy as fis_cr_actlctrlcost_indspcrcy) AS CrdtActlCtrlCostInDspCrcy,
cast(DebitActlCostInDspCrcy as fis_dr_actlctrlcost_indspcrcy) AS DebitActlCtrlCostInDspCrcy,
cast(ActlCtrlCostInDspCrcy as fis_actlctrlcost_in_dspcrcy) AS ActlCtrlCostInDspCrcy,
cast(ActualControlQuantity as fis_actlctrlqty_incostsrceunit) AS ActlCtrlQtyInCostSourceUnit,
cast(CostVarianceInDspCrcy as fco_eb_totalvarcamt_in_dspcrcy) AS CostVarianceInDspCrcy,
cast(InptPrVarcAmtInDspCrcy as fis_inptprvarcamt_in_dspcrcy) AS InptPrVarcAmtInDspCrcy,
cast(InptQtyVarcAmtInDspCrcy as fis_inptqtyvarcamt_in_dspcrcy) AS InptQtyVarcAmtInDspCrcy,
cast(RsceUsgeVarcAmtInDspCrcy as fis_rsceusgevarcamt_in_dspcrcy) AS RsceUsgeVarcAmtInDspCrcy,
cast(ScrapVarcAmtInDspCrcy as fis_scrapvarcamt_in_dspcrcy) AS ScrapVarcAmtInDspCrcy,
cast(MixedPrVarcAmtInDspCrcy as fco_eb_mixprvarcamt_in_dspcrcy) AS MixedPrVarcAmtInDspCrcy,
cast(OutpPrVarcAmtInDspCrcy as fis_outpprvarcamt_in_dspcrcy) AS OutpPrVarcAmtInDspCrcy,
cast(LotSizeVarcAmtInDspCrcy as fis_lotsizevarcamt_in_dspcrcy) AS LotSizeVarcAmtInDspCrcy,
cast(RmngVarcAmtInDspCrcy as fco_eb_rmngvarcamt_in_dspcrcy) AS RmngVarcAmtInDspCrcy,
cast(WIPCostInDspCrcy as fis_wipcost_in_dspcrcy) AS WIPCostInDspCrcy,
cast(UnrlzdCostRsrvAmtInDspCrcy as fis_abgruekfk) AS UnrlzdCostRsrvAmtInDspCrcy,
cast((WIPCostInDspCrcy + UnrlzdCostRsrvAmtInDspCrcy) as abgbesges) AS TotalWIPAmountInDspCrcy,
cast(WIPQuantity as fis_wip_quantity) AS WIPQuantity,
cast(DebitActlPlnDiffCostInDspCrcy as fis_dractlplndiffcostindspcrcy ) AS DebitActlPlnDiffCostInDspCrcy,
cast(DebitActlPlanDiffPercent as fis_dr_cocrcy_actlplndiffpct ) AS DebitActlPlanDiffPercent,
cast(ActlPlnDiffCostInDspCrcy as fis_actlplndiffcost_in_dspcrcy) AS ActlPlnDiffCostInDspCrcy,
cast(DspCrcyActlPlanDiffPct as fis_cocrcy_actlplndiffpct ) AS DspCrcyActlPlanDiffPct,
cast(ActlPlanDiffQuantity as fis_actlplandiffquantity) AS ActlPlanDiffQuantity,
cast(ActlPlanDiffQtyPct as fis_actlplandiffoutpqtypercent) AS ActlPlanDiffQtyPct,
cast(DebitActlTgtDiffCostInDspCrcy as fis_dractltgtdiffcostindspcrcy) AS DebitActlTgtDiffCostInDspCrcy,
cast(DebitActlTgtDiffPercent as fis_dr_cocrcy_actltgtdiffpct ) AS DebitActlTgtDiffPercent,
cast(ActlTgtDiffCostInDspCrcy as fis_actltgtdiffcost_in_dspcrcy) AS ActlTgtDiffCostInDspCrcy,
cast(ActlTgtDiffQuantity as fis_actltgtdiffqty) AS ActlTgtDiffQuantity,
cast(DspCrcyActlTgtDiffPct as fis_dspcrcy_actltgtdiffpct ) AS DspCrcyActlTgtDiffPct,
cast(ActlTgtDiffQtyPct as fis_actltgtdiffqtypct) AS ActlTgtDiffQtyPct,
cast((PlanCtrlCostInDspCrcy - TargetCostInDspCrcy) as fis_plnctrltgtdiff_indspcrcy) AS PlnCtrlTgtDiffCostInDspCrcy,
cast(0 as fis_dspcrcy_plnctrltgtdiffpct) AS DspCrcyPlnCtrlTgtDiffPct,
cast((ActlCtrlCostInDspCrcy - TargetCostInDspCrcy) as fis_actlctrltgtdiff_indspcrcy) AS ActlCtrlTgtDiffCostInDspCrcy,
cast(0 as fis_dspcrcy_actlctrltgtdiffpct) AS DspCrcyActlCtrlTgtDiffPct,
cast( CostComponentStructure as ck_elesmhk) AS CostComponentStructure
FROM P_EBOC_OrderAndItemCosts5
LEFT OUTER JOIN I_Material AS _Material ON Material = _Material.Material -- association [0..1]
LEFT OUTER JOIN I_MfgDebitCreditCode AS _MfgDebitCreditCode ON ControllingDebitCreditCode = _MfgDebitCreditCode.ManufacturingDebitCreditCode -- association [0..1]
LEFT OUTER JOIN I_COProdnOrderBusTrans AS _COProdnOrderBusTrans ON MfgOrderBusTransactionType = _COProdnOrderBusTrans.MfgOrderBusTransactionType -- association [0..1]
LEFT OUTER JOIN I_GLAccountText AS _GLAccountTxt ON ChartOfAccounts = _GLAccountTxt.ChartOfAccounts AND CostElement = _GLAccountTxt.GLAccount -- association [0..*]
LEFT OUTER JOIN I_CostComponentText AS _CostComponentTxt ON CostComponent = _CostComponentTxt.CostComponent AND CostComponentStructure = _CostComponentTxt.CostComponentStructure -- association [0..*]
LEFT OUTER JOIN I_CostCenterText AS _CostCenterText ON OriginCostCenter = _CostCenterText.CostCenter AND ControllingArea = _CostCenterText.ControllingArea -- association [0..*]
LEFT OUTER JOIN I_CostCenterText AS _PartnerCostCenterText ON PartnerCostCenter = _PartnerCostCenterText.CostCenter AND ControllingArea = _PartnerCostCenterText.ControllingArea -- association [0..*]
LEFT OUTER JOIN I_CostCenterActivityTypeText AS _CostCenterActivityTypeText ON ControllingArea = _CostCenterActivityTypeText.ControllingArea AND OriginCostCtrActivityType = _CostCenterActivityTypeText.CostCtrActivityType -- association [0..*]
LEFT OUTER JOIN I_CostCenterActivityTypeText AS _PrtrCostCenterActvtTypeText ON ControllingArea = _PrtrCostCenterActvtTypeText.ControllingArea AND PartnerCostCtrActivityType = _PrtrCostCenterActvtTypeText.CostCtrActivityType -- association [0..*]
LEFT OUTER JOIN I_ProfitCenter AS _ProfitCenter ON ControllingArea = _ProfitCenter.ControllingArea AND ProfitCenter = _ProfitCenter.ProfitCenter -- association [0..*]
;