1 Reply Latest reply on Apr 9, 2018 10:57 AM by Dave Gutman

    Query showing all batches linked to a Sales Order

    Brian Dugas

      I need to write a query showing all batches that were linked to a specific Sales Order.  How do I link the Sales Order and Batches?  Has anyone written such a query or CR that they can share?

       

      Thanks in advance

      Brian

        • 1. Re: Query showing all batches linked to a Sales Order
          Dave Gutman

          Hi Brian,

           

          Here's the core logic I used to solve this for a customer on the SQL Server version:

          SELECT {whatever fields you need}

          FROM IBT1 AS T0

            INNER JOIN OBTN AS T1 ON T1.ItemCode = T0.ItemCode AND T1.DistNumber = T0.BatchNum

            INNER JOIN ORDR AS T3 ON T3.DocEntry = T0.BaseEntry

          WHERE T0.BaseType = 17 AND T0.Quantity <> 0 AND T3.CardCode = '100' AND T3.Confirmed = 'Y'

           

          This should give a good starting point.  You'll need to make changes if this is under Hana.