Skip to Content

using batches on ign1 and using it in delivery

the sequence of my scenario:

-created a sales order with item that is maintained batch wise.

-now created a production order and linked sales order.

-then created multiple reciepts from production for that production order and created batches for reciepts

- now creating deliveries for that sales order and mentioned which batch to use in the delivery.

- now i have a parameter in sql which takes docentry for delivery. i wanted whatever docentry i enter i only get entries for those batches.

- i am getting all batches from reciept.

i have used this following query in sql.

ALTER proc [dbo].[TEST_1] 34

(

@DOCKEY int

)

AS

BEGIN

SET NOCOUNT ON

select ign1.U_wtpc[IGN],oign.DocEntry[oign],OWOR.DOCNUM,OITL.LOGENTRY[OIT],ITL1.SysNumber[ITL] , OBTN.AbsEntry[OBT],ORDR.DocNum[ORDR],RDR1.ItemCode[RDR] ,DLN1.DocEntry[DLN],ODLN.DocEntry[ODL] from OIGN

inner join ign1(NOLOCK) on oign.DocEntry = ign1.DocEntry AND IGN1.BaseType=202

INNER JOIN OWOR(NOLOCK) ON IGN1.BaseEntry = OWOR.DocEntry

INNER JOIN OITL(NOLOCK) ON IGN1.DOCENTRY=OITL.APPLYENTRY AND IGN1.LINENUM = OITL.APPLYLINE AND OITL.APPLYTYPE=59 AND OITL.DOCTYPE = OIGN.OBJTYPE

INNER JOIN ITL1(NOLOCK) ON OITL.LogEntry = ITL1.LogEntry

INNER JOIN OBTN(NOLOCK) ON OBTN.ItemCode = OITL.ItemCode AND ITL1.MdAbsEntry = OBTN.AbsEntry AND OBTN.SysNumber = ITL1.SysNumber

LEFT JOIN ORDR(NOLOCK) ON OWOR.OriginAbs = ORDR.DocEntry INNER JOIN RDR1(NOLOCK) ON ORDR.DocEntry = RDR1.DocEntry

LEFT JOIN DLN1(NOLOCK) ON RDR1.DocEntry = DLN1.BaseEntry AND RDR1.LineNum = DLN1.BaseLine AND RDR1.ObjType = DLN1.BaseType

INNER JOIN ODLN(NOLOCK) ON DLN1.DocEntry = ODLN.DocEntry

WHERE ODLN.DocEntry = @DOCKEY

SET NOCOUNT OFF

END

Add a comment
10|10000 characters needed characters exceeded

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.