andrebajew 3/27/2019 4:03:00 PM

Great Plains Smartlist SQL Script Invalid but runs in SSMS

Have the following script in Great Plains 2015 that am trying to create a SmartList with & hitting "SQL script invalid".   See the recommendations to enable debugging flags but don't want to take the chance of impacting anyone so close to month end. Anything in the script below happen to jump out as something you might have seen as an issue in GP 2015 ? The SQL runs well via SSMS.   Thanks!  

SELECT DB_NAME() AS [Company ID],
T1.[PONUMBER] as [PO Number],
CASE T1.POSTATUS 
WHEN '1' THEN 'New'  
WHEN '2' THEN 'Released'  
WHEN '3' THEN 'Change Order'  
WHEN '4' THEN 'Received'  
WHEN '5' THEN 'Closed' 
WHEN '6' THEN 'Cancelled' 
END AS 'PO Status',
CASE T2.POLNESTA 
WHEN '1' THEN 'New'  
WHEN '2' THEN 'Released'  
WHEN '3' THEN 'Change Order'  
WHEN '4' THEN 'Received'  
WHEN '5' THEN 'Closed' 
WHEN '6' THEN 'Cancelled' 
END AS 'PO Line Status',
T1.[USER2ENT] as [User to Enter],
T1.[DOCDATE] as [Document Date],
T1.[VENDORID] as [Vendor ID],
T1.[VENDNAME] as [Vendor Name],
T1.[PYMTRMID] as [Payment Terms ID],
isnull(T2.[JOBNUMBR], '') as [Job Number],
isnull(T2.[COSTCODE], '') as [Cost Code],
isnull(T2.[ITEMNMBR], '') as [Item Number],
isnull(T2.[ITEMDESC], '') as [Item Description],
isnull(T2.[VENDORID], '') [Vendor ID],
isnull(T2.[VNDITNUM], '') as [Vendor Item Number],
isnull(T2.[VNDITDSC], '') as [Vendor Item Description],
isnull(T2.[LOCNCODE], '') as [Location Code],
isnull(T2.[UOFM], '') as [U of M], 
isnull(T2.[QTYORDER], 0) as [QTY Ordered],
isnull(T2.[QTYCANCE], 0) as [QTY Canceled],
isnull(T2.[UNITCOST], 0) as [Unit Cost], 
isnull(T2.[EXTDCOST], 0) as [Extended Cost],
CONCAT (ACTNUMBR_1,ACTNUMBR_2,ACTNUMBR_3,ACTNUMBR_4) as [InventoryIndex],  
isnull(T3.[ACTDESCR], '') as [Account Description],
isnull(T2.[CURNCYID], '') as [Currency ID]
 from POP10100 T1  with (nolock) 
 LEFT JOIN POP10110 T2 with (nolock) 
 on 
 T2.[PONUMBER] =  T1.[PONUMBER] and  T2.[POTYPE] =  T1.[POTYPE]
 LEFT JOIN GL00100 T3 with (nolock) 
 on 
 T3.[ACTINDX] =  T2.[INVINDX]
 where T1.[POSTATUS] in (1,2,3,4)
 and T2.[POLNESTA] in (1,2,3)   

Version: GP 2015, GP 2013
Section: Dynamics GP, SQL Scripts


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3