cancel
Showing results for 
Search instead for 
Did you mean: 

DI API / SQL : How to find whether PO hyas been received and when?

Former Member
0 Kudos
57

Does anyone knows "the correct way" of finding out whether Purchase Order has been recieved and when? I tried of implement this using SQL queries run via DI API, but my solution does look smart to me as it retrieves information from number of tables and involves some logic.

Please share your experience. Thaks

P.S. If I find proper way of implementing this, I will post it into this tread.

Accepted Solutions (1)

Accepted Solutions (1)

AlexGrebennikov
Active Contributor
0 Kudos

Hi Oleksiy!

The following query will give u all purchases based on PO.

All u need is to alter it or insert some conditions.

Hope i undestand your trouble in right way.

SELECT
	T0.DocNum	as N'OPCH doc num',
	T0.DocDate	as N'OPCH doc date',
	T1.LineNum	as N'OPCH line num',
	T1.ItemCode	as N'ItemCode',
	T3.DocDate	as N'PO date',
	T3.DocNum	as N'PO doc num'
FROM
	OPCH T0
	LEFT JOIN PCH1 T1 ON
		T1.DocEntry = T0.DocEntry
		AND
		T1.BaseType = 22
	LEFT JOIN POR1 T2 ON
		T2.DocEntry = T1.BaseEntry
	LEFT JOIN OPOR T3 ON
		T3.DocEntry = T2.DocEntry
WHERE
	T3.DocNum IS NOT NULL

Answers (1)

Answers (1)

Former Member
0 Kudos

Check the target document field on the purchase order line.

Dave