P_StockTransportOrders

DDL: P_STOCKTRANSPORTORDERS SQL: PSTKTRANORD Type: view COMPOSITE

P_StockTransportOrders is a Composite CDS View in SAP S/4HANA. It reads from 6 data sources and exposes 13 fields with key fields Material, Plant, MRPArea. It has 1 association to related views.

Data Sources (6)

SourceAliasJoin Type
I_ChangeDocumentItem _changedoc left_outer
I_DemandDrivenPurDocHeader _ekko inner
I_DemandDrivenPurDocItem _ekpo inner
I_GoodsMovementDocument _matmovdoc from
I_GoodsMovementDocument _matmovdoc2 inner
P_DemandDrivenProdslHorizon P_DemandDrivenProdslHorizon inner

Parameters (2)

NameTypeDefault
p_days abap.int2
p_date sydatum

Associations (1)

CardinalityTargetAliasCondition
[1..1] I_DemandDrivenProduct1 _ddprod _ddprod.Material = _matmovdoc.Material and _ddprod.Plant = _matmovdoc.Plant and _ddprod.MRPArea = _ekpo.MRPArea

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PSTKTRANORD view
AbapCatalog.compiler.compareFilter true view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #COMPOSITE view
VDM.private true view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (13)

KeyFieldSource TableSource FieldDescription
KEY Material I_GoodsMovementDocument Material Vehicle Model
KEY Plant I_GoodsMovementDocument Plant Valuation Area
KEY MRPArea I_DemandDrivenPurDocItem MRPArea MRP Area
PurchasingDocument I_DemandDrivenPurDocHeader PurchasingDocument Purchasing Document
PurchasingDocumentItem
PurchasingOrganization I_DemandDrivenPurDocHeader PurchasingOrganization Purchasing Organization
ReplenishmentType
SourceOfSupply I_GoodsMovementDocument IssuingOrReceivingPlant Transfer Plant
CreationDate I_DemandDrivenPurDocHeader CreationDate Time Stamp
ReleaseDate
PostingDate I_GoodsMovementDocument PostingDate Posting Date for GR
datsasStartDate
PostingDateendendasDifferenceInDays

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_StockTransportOrders.
-- 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: PSTKTRANORD
-- Parameters: p_days : abap.int2, p_date : sydatum

CREATE VIEW P_StockTransportOrders AS
SELECT
  _matmovdoc.Material AS Material,
  _matmovdoc.Plant AS Plant,
  _ekpo.MRPArea AS MRPArea,
  _ekko.PurchasingDocument AS PurchasingDocument,
  cast(_ekpo.PurchasingDocumentItem as abap.char( 5 )) AS PurchasingDocumentItem,
  _ekko.PurchasingOrganization AS PurchasingOrganization,
  cast('T' as abap.char( 1 ) ) AS ReplenishmentType,
  _matmovdoc2.IssuingOrReceivingPlant AS SourceOfSupply,
  _ekko.CreationDate AS CreationDate,
  _changedoc._ChangeDocument.CreationDate AS ReleaseDate,
  _matmovdoc.PostingDate AS PostingDate,
  cast(case when _ddprod.LeadTimeCalculationMethod = 'HCRE' then _ekko.CreationDate when _ddprod.LeadTimeCalculationMethod = 'HREL' then _changedoc._ChangeDocument.CreationDate end as abap.dats ) as StartDate AS datsasStartDate,
  case when _ddprod.LeadTimeCalculationMethod = 'HCRE' then case when _ekko.CreationDate = _matmovdoc.PostingDate then 1 else dats_days_between(_ekko.CreationDate,_matmovdoc.PostingDate) end when _ddprod.LeadTimeCalculationMethod = 'HREL' then case when _changedoc._ChangeDocument.CreationDate = _matmovdoc.PostingDate then 1 else dats_days_between(_changedoc._ChangeDocument.CreationDate,_matmovdoc.PostingDate) end end as DifferenceInDays AS PostingDateendendasDifferenceInDays
FROM I_GoodsMovementDocument AS _matmovdoc
INNER JOIN I_DemandDrivenPurDocItem AS _ekpo ON /* join condition not captured in parsed metadata */
INNER JOIN I_DemandDrivenPurDocHeader AS _ekko ON /* join condition not captured in parsed metadata */
INNER JOIN P_DemandDrivenProdslHorizon ON /* join condition not captured in parsed metadata */
INNER JOIN I_GoodsMovementDocument AS _matmovdoc2 ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_ChangeDocumentItem AS _changedoc ON /* join condition not captured in parsed metadata */
LEFT OUTER JOIN I_DemandDrivenProduct1 AS _ddprod ON _ddprod.Material = _matmovdoc.Material AND _ddprod.Plant = _matmovdoc.Plant AND _ddprod.MRPArea = _ekpo.MRPArea  -- association [1..1]
;