我需要查询,我可以看到开放的销售订单数量(采购订单和库存),但我需要根据客户参考查看。我有一个很多商店的顾客。和他的订单#加入商店#。因此,在每个订单下,一次可以有100个商店。对于每个商店,SAP B1 9.1中都有一个销售订单,其参考类似于818201-3001(PO#-Store#),因此可以根据商店地址发货。拆分“NUMATCARD”并在商店层面整合数量超出了我的方法。
我需要一个查询,将结果显示为附加的输出表。enter image description here [在此处输入图像说明] [2]
答案 0 :(得分:0)
我有这个查询,但无法将CustomerRef翻译成行和列。
SELECT T0.[DocDueDate],
T0.[CardName],
T0.[NumAtCard],
T0.[DocNum],
T1.[ItemCode],
T1.[Dscription],
T3.[WhsCode],
T3.[OnHand] - SUM(OpenQty) OVER (Partition By T1.ItemCode ORDER BY DocDueDate, LineNum, NumAtCard, DocNum) + SUM(T1.OpenQty) AS 'Available',
SUM(T1.[Quantity]) AS 'PO QTY',
SUM(T1.OpenQty) AS 'To Release'
FROM
ORDR T0
INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode]
INNER JOIN OITW T3 ON T2.[ItemCode] = T3.[ItemCode] AND T1.[WhsCode] = T3.[WhsCode]
WHERE
T0.[CardCode] = 'c00192' and
T0.[DocStatus] = 'O' AND
T1.[LineStatus] = 'O' AND
T0.[CANCELED] = 'N' AND
T1.[WhsCode] = '161'
GROUP BY
T0.[DocDueDate],
T0.[CardName],
T0.[NumAtCard],
T0.[DocNum],
T1.[ItemCode],
T1.[Dscription],
T3.[OnHand],
T3.[WhsCode],
T1.[LineNum],
T1.OpenQty
ORDER BY
T0.[DocDueDate],
T0.[NumAtCard],
T0.[DocNum]