Skip to Content
0
Former Member
Sep 14, 2011 at 08:11 AM

problem with a query

34 Views

hello there

i try to make a query but the behavior of my sbo is a little bit strange

i have the following tsql code made

SELECT ign1.itemcode,ign1.dscription,oign.docdate,

(select oitm.U_INTCODE from oitm where oitm.itemcode = '71107') ,

oitm.CSTGRPCODE,ign1.baseentry,sum(IGN1.QUANTITY) as 'u03A0u03BFu03C3όu03C4u03B7u03C4u03B1'

FROM IGN1

inner join OIGN on ign1.docentry=oign.docentry

full outer join oitm on oitm.docentry=ign1.docentry

cross join oitg

WHERE

OIGN.DOCDATE='2011-01-19'

and IGN1.ITEMCODE='71107'

and oitg.itmstypcod='63'

GROUP BY ign1.itemcode,oign.docdate,ign1.dscription,oitm.U_INTCODE,oitm.CSTGRPCODE,ign1.baseentry

the above query works fine in sql server but trying to change the values from static to dynamic, lets consider that i want prompt the user to type the itemcode and the docdate, the above query will be like

SELECT ign1.itemcode,ign1.dscription,oign.docdate,

(select oitm.U_INTCODE from oitm where oitm.itemcode = '[%0]') ,

oitm.CSTGRPCODE,ign1.baseentry,sum(IGN1.QUANTITY) as 'u03A0u03BFu03C3όu03C4u03B7u03C4u03B1'

FROM IGN1

inner join OIGN on ign1.docentry=oign.docentry

full outer join oitm on oitm.docentry=ign1.docentry

cross join oitg

WHERE

OIGN.DOCDATE='[%1]''

and IGN1.ITEMCODE='[%0]'

and oitg.itmstypcod='63'

GROUP BY ign1.itemcode,oign.docdate,ign1.dscription,oitm.U_INTCODE,oitm.CSTGRPCODE,ign1.baseentry

the strange thing is that by trying to execute the above query, the sap comes up with the following error

column ign1.itemcode is invalid in the select list because it is not contained in either an aggregate function or in the GROUP BY clause. 2)microsoft sql native client sql server statement "SEWSY