P_MaintOrdNmbrOfOpenPO

DDL: P_MAINTORDNMBROFOPENPO SQL: PMAINTORDOPPO Type: view CONSUMPTION

P_MaintOrdNmbrOfOpenPO is a Consumption CDS View in SAP S/4HANA. It reads from 1 data source (I_PurgDocAccountAssignment) and exposes 5 fields with key field MaintenanceOrder.

Data Sources (1)

SourceAliasJoin Type
I_PurgDocAccountAssignment I_PurgDocAccountAssignment from

Annotations (6)

NameValueLevelField
AbapCatalog.sqlViewName PMAINTORDOPPO view
AccessControl.authorizationCheck #NOT_REQUIRED view
VDM.viewType #CONSUMPTION view
VDM.private true view
ClientHandling.type #CLIENT_DEPENDENT view
ClientHandling.algorithm #SESSION_VARIABLE view

Fields (5)

KeyFieldSource TableSource FieldDescription
KEY MaintenanceOrder OrderID Order ID
NmbrOfOpenPurchaseOrderItems
MaintOrdHasOpenPurchaseOrders
NmbrOfOpenServiceItems
MaintOrdHasOpenServices

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_MaintOrdNmbrOfOpenPO.
-- 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: PMAINTORDOPPO

CREATE VIEW P_MaintOrdNmbrOfOpenPO AS
SELECT
  OrderID AS MaintenanceOrder,
  cast( sum( case when ProductType = '1' then 1 else 0 end ) as abap.int4 ) AS NmbrOfOpenPurchaseOrderItems,
  cast( max( case when ProductType = '1' then 'X' else '' end ) as xfeld preserving type ) AS MaintOrdHasOpenPurchaseOrders,
  cast( sum( case when PurchasingDocumentItemCategory = '9' then 1 else 0 end ) as abap.int4 ) AS NmbrOfOpenServiceItems,
  cast( max( case when PurchasingDocumentItemCategory = '9' then 'X' else '' end ) as xfeld preserving type ) AS MaintOrdHasOpenServices
FROM I_PurgDocAccountAssignment
;