SELECT
IT.CODE AS ITCODE,
IT.NAME AS ITNAME,
VA.CODE AS VCODE,
VA.NAME AS VNAME,
SUM(ST.ONHAND) AS MIKTAR,
WH.NAME AS DEPO
FROM
LV_001_02_STINVTOT_V1 ST, LG_001_VARIANT VA, LG_001_ITEMS IT, L_CAPIWHOUSE WH
WHERE INVENNO!=-1
AND VA.LOGICALREF=ST.VARIANTREF
AND IT.LOGICALREF=ST.STOCKREF
AND ST.INVENNO=WH.NR
AND WH.FIRMNR=1
GROUP BY WH.NAME,ST.STOCKREF,ST.VARIANTREF,VA.CODE,VA.NAME,IT.CODE,IT.NAME
ORDER BY IT.CODE DESC