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

Material Issued and Received, with Batch Num from Production for a Project

Material Issued and Received, with Batch Number from Production Orders for a Project

This SAP Business One Query is designed to list all the material issued and received from Production Orders for a specified Project. Batch numbers are also included. This is a great HANA query to use as a base for additional variations, or for those who require good batch reporting.

SELECT
T0."PostDate",
T0."DocNum",
T0."PlannedQty",
CASE
WHEN (T3."BaseType" = '59' AND T3."Direction" = '0' AND T0."ItemCode" = T3."ItemCode") THEN 'Received'
END "Direction",
T0."ItemCode",
T3."Quantity",
T3."BatchNum",
CASE
WHEN (T2."BaseType" = '60' AND T2."Direction" = '1' AND T1."ItemCode" = T2."ItemCode") THEN 'issued'
END "Direction",
T2."Quantity",
T2."ItemCode",
T2."BatchNum"
FROM "OWOR" T0
INNER JOIN WOR1 T1 ON T0."DocEntry" = T1."DocEntry"
LEFT OUTER JOIN IBT1 T2 ON T2."BsDocEntry" = T0."DocEntry" AND T2."BsDocLine" = T1."LineNum"
LEFT OUTER JOIN IBT1 T3 ON T3."BsDocEntry" = T0."DocEntry" AND T0."ItemCode" = T3."ItemCode" WHERE T2."BsDocType" = '202' AND (T0."Status" = 'R' OR T0."Status" = 'L') AND T0."Project" = [%0]

 

This SAP Business One Query was actually written for SQL by Nagarajan K. The illbejiggered team converted it from SQL to HANA.