Skip to Content
0
Jul 27, 2015 at 03:20 PM

Assistance with approval template query

51 Views

Hi experts,

I am having difficulty implementing an approval procedure for the following situation:

A Sales Order for a specified customer (CHIG002) which has parts from a specific 'Preferred supplier' (SBRE001) must have approval.

I also want the approval to work if the part does not have 'SBRE001' as the Preferred supplier but the part has a child component which has 'SBRE001 as the Preferred supplier.

This is beyond my capability but I am working on the following query and would appreciate some assistance to make this work?

SELECT DISTINCT 'TRUE' from dbo.ORDR T0

INNER JOIN dbo.RDR1 T1 ON T1.DocEntry=T0.DocEntry

INNER JOIN dbo.OITM T2 ON T2.ItemCode=T1.ItemCode

INNER JOIN dbo.OITT T3 ON T3.Code=T2.ItemCode

INNER JOIN dbo.ITT1 T4 ON T4.Father=T3.Code

WHERE (T0.CardCode = 'CHIG002') AND (T2.CardCode='SBRE001' OR ??component part??)

Thanks for any assistance

Karen