Skip to Content
0
Former Member
Mar 04, 2009 at 04:23 PM

Help required in SQL

25 Views

Hi all,

The scenario is that once we create a GRPO, then the items go for a quality check. We do an inventory transfer at this stage and capture the GRPO doc number in the remarks field. Here, we do a transfer of inventory to rejected warehouse if required. The report that we are looking for is to capture the details as follows;

1, Item code, item number quantity and warehouse code(which i'm trying to pull from PDN1)

2.In stock (from OITM)

3. Warehouse code as Rejected (from WTR1, this is the To warehouse)

4. Remarks (Remarks from Owtr where we plan to enter the GRPO number)

The query that i came up with is fetching wrong data:

SELECT T1.[ItemCode], T1.[Dscription], T1.[Quantity],T1.[WhsCode], T2.[OnHand], T3.[WhsCode], T3.[Quantity],

T4.[Comments] FROM OPDN T0 INNER JOIN PDN1 T1

ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN WTR1 T3

ON T2.ItemCode = T3.ItemCode INNER JOIN OWTR T4 ON T3.DocEntry = T4.DocEntry

Can anyone please help me in correcting the SQL??

Thanks in advance,

Joseph