Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query Purchasing Report per Project

Dear all,

I want to make query that can give me information about purchasing report per project. The data should come from AP invoice and AP credit memo (item and service type). I use project code field in the form to filter data.

Thanks before for your kind help

Former Member
Former Member replied

Hai!

Try this

Declare @project as nvarchar(30)
set @Project = (select max(S0.PrjCode) from OPRJ S0 where S0.PrjCode='[%0]')
Select
a.Itemcode,
max(a.Name) Name,
sum(a.quantity) Quantity,
sum(a.price) Price,
sum(a.linetotal) Line_Total from (
SELECT 
T1.ItemCode,
max(T1.Dscription) Name,
sum(T1.Quantity) Quantity,
sum(T1.Price) Price,
sum(T1.LineTotal) LineTotal
From
PCH1 T1,OPRJ P0
where
T1.Project=P0.PrjCode and
T1.Project = @Project
Group By
T1.ItemCode
UNION All
SELECT 
T1.ItemCode,
max(T1.Dscription) Name,
sum(T1.Quantity) Quantity,
sum(T1.Price) Price,
sum(T1.LineTotal) Line_Total
From
RPC1 T1,OPRJ P0
where
T1.Project=P0.PrjCode and
T1.Project = @Project
Group By
T1.ItemCode) a
Group By
a.ItemCode

Regards,

Thanga Raj.K

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question