Find insufficient quantity in Integration failures logs iVend to SAPB1

Find insufficient quantity in Integration failures logs iVend to SAPB1

Environment:

iVend Version 6.6

Problem Statement:

There may be various integration failures logs from iVend to SAPB1 ,failed due to insufficient quantity in SAPB1.

Symptoms:

Not Applicable

Resolution/Work Around:

The Below Query will result the rows which have less qty in SAP for the Stuck Stock Transfers
WITH STOCKTransfer AS 
(
 SELECT E.Id AS ItemCode, C.Id AS WhsCode, SUM(D.Quantity) AS [QtyToMove]
 FROM InvStockTransfer A 
 INNER JOIN RepIntegrationLog B ON A.StockTransferKey = B.SourceKey
 INNER JOIN InvWarehouse C ON A.FromWarehouseKey = C.WarehouseKey
 INNER JOIN InvStockTransferDetail D ON A.StockTransferKey = D.StockTransferKey 
 INNER JOIN InvProduct E ON D.ProductKey = E.ProductKey  
 WHERE B.Status = 1 AND B.SourceType = 53
 GROUP BY E.Id , C.Id
)
SELECT A.ItemCode, A.WhsCode, A.QtyToMove , OITW.OnHand [SAP QTY], A.QtyToMove - OITW.OnHand AS [Variance] 
FROM STOCKTransfer A 
LEFT OUTER JOIN SHB_PRD ..OITW AS OITW ON A.ItemCode = OITW.ItemCode collate SQL_Latin1_General_CP850_CI_AS 
AND A.WhsCode = OITW.WhsCode collate SQL_Latin1_General_CP850_CI_AS 
WHERE A.QtyToMove > OITW.OnHand 
The Below Query will result the rows which have less qty in SAP for the Stuck Invoices
WITH Invoice AS 
(
 SELECT E.Id AS ItemCode, C.Id AS WhsCode, SUM(D.Quantity) AS [QtyToMove]
 FROM TrxTransaction A 
 INNER JOIN RepIntegrationLog B ON A.TransactionKey = B.SourceKey
 INNER JOIN TrxTransactionSaleItem D ON A.TransactionKey = D.TransactionKey
 INNER JOIN InvWarehouse C ON D.WarehouseKey = C.WarehouseKey  
 INNER JOIN InvProduct E ON D.ProductKey = E.ProductKey  
 WHERE B.Status = 1 AND B.SourceType = 143
 GROUP BY E.Id , C.Id
)
SELECT A.ItemCode, A.WhsCode, A.QtyToMove , OITW.OnHand [SAP QTY], A.QtyToMove - OITW.OnHand AS [Variance] 
FROM Invoice A 
LEFT OUTER JOIN Colio ..OITW AS OITW ON A.ItemCode = OITW.ItemCode collate SQL_Latin1_General_CP850_CI_AS 
AND A.WhsCode = OITW.WhsCode collate SQL_Latin1_General_CP850_CI_AS 
WHERE A.QtyToMove > OITW.OnHand 

Recommendations /Suggestion:

Not Applicable