P_POHistoryForInvoice

DDL: P_POHISTORYFORINVOICE SQL: POHISTINVOICE Type: view CONSUMPTION Package: ODATA_MM_ANALYTICS

PO History for Invoice Receipts

P_POHistoryForInvoice is a Consumption CDS View that provides data about "PO History for Invoice Receipts" in SAP S/4HANA. It reads from 3 data sources (I_PurchaseOrder, I_PurchaseOrderHistory, I_PurchaseOrderItem) and exposes 5 fields with key fields PurchaseOrder, PurchaseOrderItem. Part of development package ODATA_MM_ANALYTICS.

Data Sources (3)

SourceAliasJoin Type
I_PurchaseOrder PurchaseOrder inner
I_PurchaseOrderHistory PurchaseOrderHistory from
I_PurchaseOrderItem PurchaseOrderItem inner

Parameters (2)

NameTypeDefault
P_StartDate bedat
P_EndDate bedat

Annotations (7)

NameValueLevelField
AbapCatalog.sqlViewName POHISTINVOICE view
AbapCatalog.compiler.compareFilter true view
AbapCatalog.preserveKey true view
AccessControl.authorizationCheck #NOT_REQUIRED view
ClientHandling.algorithm #SESSION_VARIABLE view
VDM.viewType #CONSUMPTION view
VDM.private true view

Fields (5)

KeyFieldSource TableSource FieldDescription
KEY PurchaseOrder I_PurchaseOrderHistory PurchaseOrder Purchasing Document
KEY PurchaseOrderItem I_PurchaseOrderItem PurchaseOrderItem Purchasing Document Item
PostingDate PostingDate Posting Date for GR
Currency Currency Valuation Crcy
curr223asInvoiceAmount

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_POHistoryForInvoice.
-- 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: POHISTINVOICE
-- Parameters: P_StartDate : bedat, P_EndDate : bedat

CREATE VIEW P_POHistoryForInvoice AS
SELECT
  PurchaseOrderHistory.PurchaseOrder AS PurchaseOrder,
  PurchaseOrderItem.PurchaseOrderItem AS PurchaseOrderItem,
  PostingDate,
  Currency,
  cast(case DebitCreditCode when 'H' then -1 * PurchaseOrderAmount when 'S' then PurchaseOrderAmount else 0 end as abap.curr(22,3) ) as InvoiceAmount AS curr223asInvoiceAmount
FROM I_PurchaseOrderHistory AS PurchaseOrderHistory
INNER JOIN I_PurchaseOrder AS PurchaseOrder ON /* join condition not captured in parsed metadata */
INNER JOIN I_PurchaseOrderItem AS PurchaseOrderItem ON /* join condition not captured in parsed metadata */
;