Skip to Content
0

Query to find B2B Sales Order with earlier delivery date than linked PO

May 11, 2017 at 12:56 PM

19

avatar image

Hi Experts

I am trying to create a query and alert to show where Sales Order which a linked Purchase Order (back to back ordering) have a diffference in delivery dates where the Sales Order rows are showing an earlier deilivery to the Purchase Order which means delivery would not be possible. My query is running into problems and I am not sure where to look for answers, The query runs okay but it is showing me both rows with an earlier delivery date and later delivery to the respective PO:

select distinct T0.[DocNum] , T0.[U_ReadyTD] , T0.[CardCode] , T0.[CardName] , T0.[DocDueDate] , T1.[LineNum] , T1.[ItemCode] , T1.[Dscription] , T1.[Quantity] , T1.[POTRGNUM] , T0.[DocDueDate] as 'SO Delivery Date' , T2.[ShipDate] as 'PO Delivery Date' from

ORDR T0 inner join RDR1 T1 on T0.DocEntry = T1.DocEntry INNER JOIN POR1 T2 ON T0.DocNum = T2.BaseRef

where T0.[DocStatus] = 'O' and T1.[POTRGNUM] is not null and 'T0.[DocDueDate]' < 'T2.[ShipDate]'

order by t0.docnum, t1.linenum

Many thanks

Geoff

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

0 Answers