cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member834429
Participant
0 Kudos

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

Accepted Solutions (0)

Answers (0)