Question : SQL to query Order details in GP

I'm new to GP 10,
 
Does anyone have a SQL script that will return all the line items for a given order?
I need to provide an order number and retieve all the details for that order

Thanks

Answer : SQL to query Order details in GP

Brian,

I am assuming SOP (Sales Order Processing) orders, if that's not the case, please give some more detail.  

For SOP, I have published a view you might find helpful that will return all SOP lines items for both posted and unposted transactions: http://victoriayudin.com/2009/05/17/sql-view-with-all-sop-line-items/.  Orders are SOPTYPE = 2, so you can filter on that if you need to.

If you simply want a quick query against the GP database, below are 2, one for open/unposted orders, another for historical/posted:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
--use this for open orders
SELECT * 
FROM	SOP10200 
WHERE SOPTYPE = 2 -- orders only
AND SOPNUMBE = 'YourOrderNumber'  -- enter your order number instead
 
--use this for historical orders
SELECT * 
FROM	SOP30300 
WHERE SOPTYPE = 2 -- orders only
AND SOPNUMBE = 'YourOrderNumber'  -- enter your order number instead
Random Solutions  
 
programming4us programming4us