Sometimes, if you are using batch management on your SAP Business One, you have trouble when you want to post a document and get an error like “Insufficient quantity for item X with batch X”
You want to know, on which document and how much, your batch number allocated? How to calculate and find your batch number allocation. There’s 2 options.
First, using Batch Number Transaction Report.
You can use both Item Code or Batch Number to find your allocated batch.
Input item I00014 on Item Number from-to fields.
It will show a report about your batch movement on your SAP Business One, it will divided with 3 directions: In, Out, and Allocation.
You can find your allocated batch number on that screen, it shows a document number on the left side for ‘Transactions for Batch’ section.
“Allocated” here means that your item is still on your system, not yet issued.
Somehow, we can say that “it was already tagged for that selected document” so, another documents can’t take away that batch number for itself.
If you need some items to issued urgently, but there’s already another document which is done “on queue” status (added earlier with selected batch) to SAP Business One, and sadly, there’s no more stock available. You can easily ‘remove’ that “reserved” batch number, and re-allocate that batch for another document which is more urgent to deliver. So, you can use this report or using a query on View Table on MsSQL Server Management Studio or Query Manager.
Second, using View Table.
Find your database name, click drop down menu on View, and find B1_SnBAllocateDocView, then right click, select top 1000 rows.
Or you can use this modified query (created based on that standard view query) below, paste it on Query Manager, and save it, so another user can use this query when they need it:
SELECT T0.[SnBAllocateViewDocType] AS AllocateDocType, T0.[SnBAllocateViewDocEntry] AS AllocateDocEntry,
CASE WHEN T2.DocEntry IS NOT NULL THEN T2.DocNum
WHEN T3.DocEntry IS NOT NULL THEN T3.DocNum
END AS AllocateDocNum, T0.[SnBAllocateViewDocLine] AS AllocateDocLine, T1.[DistNumber] AS AllocateBatchNum, T0.[SnBAllocateViewItemCode] AS AllocateItemCode, T0.[SnBAllocateViewLocCode] AS AllocatedWarehouse,
T0.[SnBAllocateViewAllocQty] AS AllocatedQty
FROM [dbo].[B1_SnBAllocateDocView] T0
INNER JOIN OBTN T1 ON T0.[SnBAllocateViewSnbMdAbs] = T1.[AbsEntry]
LEFT JOIN OWOR T2 ON T2.[DocEntry] = T0.[SnBAllocateViewDocEntry]
AND T0.[SnBAllocateViewDocType] = 202
LEFT JOIN ORDR T3 ON T3.[DocEntry] = T0.[SnBAllocateViewDocEntry]
AND T3.[ObjType] = T0.[SnBAllocateViewDocType]
INNER JOIN OITM T4 ON T0.[SnBAllocateViewItemCode] = T4.[ItemCode]
WHERE T4.[ItemCode] = ‘[%0]‘
Note: you can modify the WHERE (red font) condition based on your own preferences.
Feel free to try the sample query above 😊