some of items in OITM, I set the property, QryGroup1='Y'. if some one like to put a purchase order including those items, the purchase order must pass approval procedure. so I created a approval procedure template and add the following qery, but it doesn't work. can you check it for me? Thanks...
Declare @totalqty numeric(16,2)
Select @totalqty=sum(T1.quantity) from OPOR T0 inner join POR1 T1 on T0.DocEntry=T1.DocEntry inner join OITM T2 on T1.Itemcode = T2.ItemCode where T2.QryGroup1='Y' and T0.docNum=$[OPOR.DocNum]
select 'TRUE' where @totalqty>0