Skip to Content

Get the batch no. when print delivery note

Jan 26, 2017 at 09:23 AM


avatar image
Former Member

Hi Gurus,

I am now working on crystal report to print out a delivery not with batch number.

And I am using the store procedure to get a set of result in doing this.

However, I am not sure how to get the batch no. that used upon this delivery.

Does any documents or threads or even the SQL statement could help me in doing this?

Best Regards,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

DIEGO LOTHER Jan 27, 2017 at 03:48 PM

Hi Daniel,

I use this query to get info about warehouse movement, and with this I am able to see what are the batch/serial number of the itens and what document created them.

Just change to achieve your goal:

	ISNULL(T4.DistNumber, T5.DistNumber) AS Serial,
	ISNULL(T4.SysNumber, T5.SysNumber) AS SerialId,
	B1_OinmWithBinTransfer T0
	INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
	LEFT JOIN OITL T2 ON T2.DocType = T0.TransType AND T2.DocEntry = T0.CreatedBy AND T2.DocLine= T0.DocLineNum
		AND T2.LocCode = T0.Warehouse
	LEFT JOIN ITL1 T3 ON T2.LogEntry = T3.LogEntry
	LEFT JOIN OBTN T4 ON T4.ItemCode = T3.ItemCode AND T4.SysNumber = T3.SysNumber AND T1.manbtchnum = 'Y'
	LEFT JOIN OSRN T5 ON T5.ItemCode = T3.ItemCode AND T5.SysNumber = T3.SysNumber AND T1.mansernum = 'Y'
	T0.BASE_REF = 20
	AND T0.TransType = 20

Hope it helps.

Kind Regards,

Diego Lother

10 |10000 characters needed characters left characters exceeded
Nagarajan K Jan 27, 2017 at 11:08 PM


Try this,

SELECT T0.[DocNum], T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T4.[DistNumber]


OPLN T0 INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry left join OITL T2 on t1.docentry = T2.[ApplyEntry] and T1.[LineNum] = T2.[ApplyLine] and T2.[ApplyType] = 15 left JOIN ITL1 T3 ON T2.LogEntry = T3.LogEntry left join OBTN T4 on T4.[ItemCode] = T3.[ItemCode] and T3.[MdAbsEntry] = t4.[absentry]



10 |10000 characters needed characters left characters exceeded