Forum Navigation
You need to log in to create posts and topics.

Query - All Marketing Documents related to a Project

Here is a HANA query that lists the basic marketing documents all tied to a project i.e. Quote, Sales Order, AR Invoice, Purchase Order and AP Invoice and the respective dates and amounts.

SELECT T0."PrjCode",
T0."PrjName",
T1."DocNum" "Quote",
T1."DocDueDate" "Expire Date",
T1."DocTotal" "Quote Total",
T2."DocNum" "Order",
T2."DocDate" "Order Date",
T2."DocTotal" "Order Total",
T3."DocNum" "Inv Number",
T3."DocDate" "Inv Date",
T3."DocTotal" "Inv Total",
T4."DocNum" "Purchase Ord",
T4."CardName" "Supplier",
T4."DocTotal" "PO Amt",
T5."DocNum" "AP Number",
T5."DocDueDate" "Due Date",
T5."CardName" "Supplier",
T5."DocTotal" "AP Amt"
FROM OPRJ T0  LEFT JOIN OQUT T1 ON T0."PrjCode" = T1."Project"
LEFT JOIN ORDR T2 ON T0."PrjCode" = T2."Project"
LEFT JOIN OINV T3 ON T0."PrjCode" = T3."Project"
LEFT JOIN OPOR T4 ON T0."PrjCode" = T4."Project"
LEFT JOIN OPCH T5 ON T0."PrjCode" = T5."Project"