N_PurchaseOrder

DDL: N_PURCHASEORDER SQL: NPURCHASEORDER Type: view

Aux. View for Purchase Order Enterprise Search

N_PurchaseOrder is a CDS View that provides data about "Aux. View for Purchase Order Enterprise Search" in SAP S/4HANA. It reads from 1 data source (ekko) and exposes 56 fields with key fields PurchaseOrder, PurchaseOrderItem, AccountAssignmentNumber. It has 17 associations to related views.

Data Sources (1)

SourceAliasJoin Type
ekko ekko from

Associations (17)

CardinalityTargetAliasCondition
[0..1] I_Supplier _Supplier $projection.Supplier = _Supplier.Supplier
[0..1] I_User _CreatedByUser $projection.CreatedByUser = _CreatedByUser.UserID
[0..1] I_Plant _SupplyingPlant $projection.SupplyingPlant = _SupplyingPlant.Plant
[0..1] I_PurchasingOrganization _PurchasingOrganization $projection.PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization
[0..1] I_PurchasingGroup _PurchasingGroup $projection.PurchasingGroup = _PurchasingGroup.PurchasingGroup
[0..1] I_PurchasingDocumentType _PurchaseOrderType _PurchaseOrderType.PurchasingDocumentCategory = 'F' and $projection.PurchaseOrderType = _PurchaseOrderType.PurchasingDocumentType
[0..*] I_PurchasingDocumentTypeText _PurchaseOrderTypeName _PurchaseOrderTypeName.PurchasingDocumentCategory = 'F' and $projection.PurchaseOrderType = _PurchaseOrderTypeName.PurchasingDocumentType
[1..1] I_PurchaseOrderDeletionCode _PurchaseOrderDeletionCode $projection.PurchaseOrderDeletionCode = _PurchaseOrderDeletionCode.PurchaseOrderDeletionCode
[0..1] N_PaymentTerms _Paymentterms $projection.PaymentTerms=_Paymentterms.PaymentTerms
[0..1] I_CompanyCode _CompanyCode $projection.CompanyCode = _CompanyCode.CompanyCode
[0..1] I_IncotermsClassification _IncotermsClassification $projection.IncotermsClassification = _IncotermsClassification.IncotermsClassification
[0..1] I_Plant _Plant $projection.Plant = _Plant.Plant
[0..1] I_ProductGroup_2 _ProductGroup $projection.ProductGroup = _ProductGroup.ProductGroup
[0..1] I_BusinessArea _BusinessArea $projection.BusinessArea = _BusinessArea.BusinessArea
[0..1] I_WBSElementByInternalKey _WBSElementByInternalKey $projection.WBSElementInternalID = _WBSElementByInternalKey.WBSElementInternalID
[0..1] I_ControllingArea _ControllingArea $projection.ControllingArea = _ControllingArea.ControllingArea
[0..*] I_ProfitCenterText _ProfitCenterText $projection.ControllingArea = _ProfitCenterText.ControllingArea and $projection.ProfitCenter = _ProfitCenterText.ProfitCenter and $projection.CASystemDate < _ProfitCenterText.ValidityEndDate and $projection.CASystemDate >= _ProfitCenterText.ValidityStartDate

Annotations (9)

NameValueLevelField
AbapCatalog.sqlViewName NPURCHASEORDER view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #CHECK view
EndUserText.label Aux. View for Purchase Order Enterprise Search view
ObjectModel.usageType.serviceQuality #A view
ObjectModel.usageType.sizeCategory #L view
ObjectModel.usageType.dataClass #TRANSACTIONAL view
VDM.auxiliaryEntity.for.entity R_PurchaseOrder view

Fields (56)

KeyFieldSource TableSource FieldDescription
KEY PurchaseOrder ekko ebeln Source PurchDoc
KEY PurchaseOrderItem ekpo ebelp Item pur. doc.
KEY AccountAssignmentNumber ekkn zekkn Account Assgmt No.
CompanyCode ekko bukrs Value
CreatedByUser ekko ernam User Name
CreationDate ekko aedat Obsolete
DocumentCurrency ekko waers Transaction Currency
IncotermsClassification ekko inco1 Incoterms
IncotermsTransferLocation ekko inco2 Incoterms 2
IncotermsLocation1 ekko inco2_l Inco. Location1
IncotermsLocation2 ekko inco3_l Inco. Location2
LastChangeDateTime ekko lastchangedatetime Timestamp
PaymentTerms
PurchaseOrderDate ekko bedat Start date
PurchaseOrderDeletionCode ekko loekz Status
Supplier
SupplyingPlant ekko reswk Supplying Plant
PurchaseOrderType ekko bsart Stnd purch.ord.
PurchasingGroup ekko ekgrp Sub. purchasing grp
PurchasingOrganization ekko ekorg Purchasing Org.
PurchaseContract ekko konnr Agreement
ManufacturerMaterial ekpo ematn MPN: Material
Product
ProductGroup
NetAmount ekpo netwr Value
NetPriceAmount ekpo netpr Price
OrderQuantityUnit ekpo meins Valuation Unit
OrderQuantity ekpo menge WarrCountValue
OrderPriceUnit ekpo bprme PO Price Unit
NetPriceQuantity
Plant ekpo werks Receiving Plant
PurchaseOrderItemText ekpo txz01 Text
PurchaseRequisition ekpo banfn Requisition
IsDeleted ekpo loekz Status
BusinessArea ekkn gsber Business Area
ControllingArea ekkn kokrs Org. Value
ProfitCenter ekkn prctr Profit Centers
WBSElementInternalID ekkn ps_psp_pnr WBS Element
CASystemDate
_CompanyCode _CompanyCode
_Supplier _Supplier
_CreatedByUser _CreatedByUser
_SupplyingPlant _SupplyingPlant
_PurchasingOrganization _PurchasingOrganization
_PurchasingGroup _PurchasingGroup
_PurchaseOrderType _PurchaseOrderType
_PurchaseOrderTypeName _PurchaseOrderTypeName
_PurchaseOrderDeletionCode _PurchaseOrderDeletionCode
_IncotermsClassification _IncotermsClassification
_Paymentterms _Paymentterms
_Plant _Plant
_ProductGroup _ProductGroup
_BusinessArea _BusinessArea
_WBSElementByInternalKey _WBSElementByInternalKey
_ControllingArea _ControllingArea
_ProfitCenterText _ProfitCenterText

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 N_PurchaseOrder.
-- 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: NPURCHASEORDER

CREATE VIEW N_PurchaseOrder AS
SELECT
  ekko.ebeln AS PurchaseOrder,
  ekpo.ebelp AS PurchaseOrderItem,
  ekkn.zekkn AS AccountAssignmentNumber,
  ekko.bukrs AS CompanyCode,
  ekko.ernam AS CreatedByUser,
  ekko.aedat AS CreationDate,
  ekko.waers AS DocumentCurrency,
  ekko.inco1 AS IncotermsClassification,
  ekko.inco2 AS IncotermsTransferLocation,
  ekko.inco2_l AS IncotermsLocation1,
  ekko.inco3_l AS IncotermsLocation2,
  ekko.lastchangedatetime AS LastChangeDateTime,
  cast( ekko.zterm as farp_dzterm preserving type) AS PaymentTerms,
  ekko.bedat AS PurchaseOrderDate,
  ekko.loekz AS PurchaseOrderDeletionCode,
  cast ( ekko.lifnr as md_supplier preserving type) AS Supplier,
  ekko.reswk AS SupplyingPlant,
  ekko.bsart AS PurchaseOrderType,
  ekko.ekgrp AS PurchasingGroup,
  ekko.ekorg AS PurchasingOrganization,
  ekko.konnr AS PurchaseContract,
  ekpo.ematn AS ManufacturerMaterial,
  cast (ekpo.matnr as productnumber preserving type ) AS Product,
  cast (ekpo.matkl as productgroup preserving type ) AS ProductGroup,
  ekpo.netwr AS NetAmount,
  ekpo.netpr AS NetPriceAmount,
  ekpo.meins AS OrderQuantityUnit,
  ekpo.menge AS OrderQuantity,
  ekpo.bprme AS OrderPriceUnit,
  cast (ekpo.peinh as vdm_price_unit preserving type) AS NetPriceQuantity,
  ekpo.werks AS Plant,
  ekpo.txz01 AS PurchaseOrderItemText,
  ekpo.banfn AS PurchaseRequisition,
  ekpo.loekz AS IsDeleted,
  ekkn.gsber AS BusinessArea,
  ekkn.kokrs AS ControllingArea,
  ekkn.prctr AS ProfitCenter,
  ekkn.ps_psp_pnr AS WBSElementInternalID,
  $session.system_date AS CASystemDate
FROM ekko
LEFT OUTER JOIN I_Supplier AS _Supplier ON Supplier = _Supplier.Supplier  -- association [0..1]
LEFT OUTER JOIN I_User AS _CreatedByUser ON CreatedByUser = _CreatedByUser.UserID  -- association [0..1]
LEFT OUTER JOIN I_Plant AS _SupplyingPlant ON SupplyingPlant = _SupplyingPlant.Plant  -- association [0..1]
LEFT OUTER JOIN I_PurchasingOrganization AS _PurchasingOrganization ON PurchasingOrganization = _PurchasingOrganization.PurchasingOrganization  -- association [0..1]
LEFT OUTER JOIN I_PurchasingGroup AS _PurchasingGroup ON PurchasingGroup = _PurchasingGroup.PurchasingGroup  -- association [0..1]
LEFT OUTER JOIN I_PurchasingDocumentType AS _PurchaseOrderType ON _PurchaseOrderType.PurchasingDocumentCategory = 'F' AND PurchaseOrderType = _PurchaseOrderType.PurchasingDocumentType  -- association [0..1]
LEFT OUTER JOIN I_PurchasingDocumentTypeText AS _PurchaseOrderTypeName ON _PurchaseOrderTypeName.PurchasingDocumentCategory = 'F' AND PurchaseOrderType = _PurchaseOrderTypeName.PurchasingDocumentType  -- association [0..*]
LEFT OUTER JOIN I_PurchaseOrderDeletionCode AS _PurchaseOrderDeletionCode ON PurchaseOrderDeletionCode = _PurchaseOrderDeletionCode.PurchaseOrderDeletionCode  -- association [1..1]
LEFT OUTER JOIN N_PaymentTerms AS _Paymentterms ON PaymentTerms=_Paymentterms.PaymentTerms  -- association [0..1]
LEFT OUTER JOIN I_CompanyCode AS _CompanyCode ON CompanyCode = _CompanyCode.CompanyCode  -- association [0..1]
LEFT OUTER JOIN I_IncotermsClassification AS _IncotermsClassification ON IncotermsClassification = _IncotermsClassification.IncotermsClassification  -- association [0..1]
LEFT OUTER JOIN I_Plant AS _Plant ON Plant = _Plant.Plant  -- association [0..1]
LEFT OUTER JOIN I_ProductGroup_2 AS _ProductGroup ON ProductGroup = _ProductGroup.ProductGroup  -- association [0..1]
LEFT OUTER JOIN I_BusinessArea AS _BusinessArea ON BusinessArea = _BusinessArea.BusinessArea  -- association [0..1]
LEFT OUTER JOIN I_WBSElementByInternalKey AS _WBSElementByInternalKey ON WBSElementInternalID = _WBSElementByInternalKey.WBSElementInternalID  -- association [0..1]
LEFT OUTER JOIN I_ControllingArea AS _ControllingArea ON ControllingArea = _ControllingArea.ControllingArea  -- association [0..1]
LEFT OUTER JOIN I_ProfitCenterText AS _ProfitCenterText ON ControllingArea = _ProfitCenterText.ControllingArea AND ProfitCenter = _ProfitCenterText.ProfitCenter AND CASystemDate < _ProfitCenterText.ValidityEndDate AND CASystemDate >= _ProfitCenterText.ValidityStartDate  -- association [0..*]
;